home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 June / MacFormat 25.iso / Shareware City / Education / Extended Calculator II.ß Folder / Extended Calculator Manual < prev    next >
Encoding:
Text File  |  1994-05-02  |  115.4 KB  |  3,066 lines  |  [TEXT/Um?4]

  1.  
  2.  
  3.          ABOUT EXTENDED CALCULATOR II
  4.  
  5. This document contains important information about the Extended Calculator II, please read it carefully. The document is intended for reading with the program Document Reader. It can be read by other applications as well, but then you will not be able to take advantage of Document Reader's unique navigating capabilities.
  6.  
  7. This document should ALWAYS be distributed together with the Extended Calculator II.
  8.  
  9.     IMPORTANT NOTE!
  10.  
  11. This is a beta release so there are probably bugs left in the program. If you find any, you can always send me a note.
  12.  
  13. 1. General Instructions
  14.  
  15. 1.1. About this program
  16.  
  17. The Extended Calculator II was written by Niklas Frykholm using THINK C. The program is based on Extended Calculator, also by Niklas Frykholm, but has been rewritten almost entirely to be given more power and flexibility.
  18.  
  19. This program is ShareWare, so feel free to copy it and give it to your friends. However, if you use it and enjoy it you have to pay a small registration fee.
  20.  
  21. From now and on this program, and all my other programs are distributed as the Niklas Frykholm ShareWare package. By paying $5 (or $10 if you are filthy rich) you will be entitled to use, not only this program, but every ShareWare program that I have ever written, and that I will ever write in the future. This includes MacSnails, MacPatience, DocumentReader, CreatorChanger, BattleTanks, Extended Calculator II, Electric Poet, and any future programs.
  22.  
  23. Why am I doing this? Partly it is so that those people who do pay their ShareWare fees, will not have to be ruined, partly so that those people who don't pay their ShareWare fees will realize how good an offer this is and start paying them. But then of course, if you steal it, you will get it for free, and that's even cheaper!!! So, why should you bother to pay for this package? Well, I'm not studying ethics, so how should I know? But, maybe, just maybe, if you pay this fee you will feel a little bit more at peace with your puny human existence.
  24.  
  25. Being a ShareWare writer does not necessarily mean being swamped in admirers' letters. (I should have become a heavy metal singer, as my mother advised me to.)
  26.  
  27. So please send $5 or a corresponding amount in the currency of your choice, together with your name and address and any other important facts, that you think I should know, to:
  28.  
  29. Niklas Frykholm
  30. Rothoffsv. 37 A
  31. S-903 42 Umeå
  32. Sweden
  33.  
  34. 1.2. How to use it
  35.  
  36. This program is designed to be fairly simple to use for the layman (and still be more powerful than the pitiful excuse for a calculator that is shipped with the system). Yet the program offers advanced features, like graph-drawing and even it's own programming language for the more experienced user.
  37.  
  38. The program calculates it's result from an input string, which can be entered by clicking on the appropriate keys on the calculator or by simply typing it in. The program has been supplied with some intelligence, so it will realise that 3(2+1)+3sin3-1 means 3*(2+1) + 3*sin(3) - 1. This may however lead to some ambiguities, since in some cases, without parentheses there is really no way of knowing exactly what the user meant. 
  39.  
  40. For example if the user has typed 2*-x^2, did he/she/you mean 2*(-x)^2 or 2*(-(x^2)). When the user typed e^-x^2, did he/she/you mean e^(-(x^2)), (e^(-x))^2, or e^((-x)^2). If you suspect that your input string contains expressions like these, always include parentheses to make it exactly clear what you are meaning.
  41.  
  42. The notation used by this calculator comes from the following sources:
  43.  
  44.     1. Mathematics: + - / * ! √ …
  45.     2. Basic: ^ rnd <> …
  46.     3. Pascal: = := …
  47.     4. C: && || & | % \ …
  48.     5: My mind: *' +' -' /' …
  49.  
  50. 1.3. How to learn using the calculator
  51.  
  52. Start by opening the Calculator application. Select Layman's calculator from the Calculators menu. Try clicking on the keys and typing in expressions, until you have an idea of how it works. When you think you have got the hang of it, open the Scientific calculator.
  53.  
  54. The scientific calculator has a number of keys, that covers much of what you can do with the calculator. Besides the ability to click a key instead of typing an expression, these keys can be useful as a reminder when you have forgotten exactly what functions were available.
  55.  
  56. If you are curious and want to learn more, turn to this manual. It contains a full description of each one of the calculators, the entire set of functions that the calculator supports together with a thorough description of all the errors displayed by the calculator.
  57.  
  58. Many times a concept which applies to many calculators is only mentioned in the "simplest" calculator in which it occurs. For example, how to enter an expression is only mentioned in the Layman's Calculator section.
  59.  
  60. If you are unsure of the concept of a function it might be useful to check out the function glossary in the function reference part of this manual.
  61.  
  62. If you want to learn how to use the calculators built-in programming language to create your own programs, you should check out the section on the Programmable calculator in this manual. You should also browse through the entire set of functions, so that you have an idea of which tools are available to you. If you still have trouble grasping the concept of programming (which in fact is not so different from calculating), I suggest you get hold of a beginners book on programming. Many of the concepts of the Extended Calculator's programming language are similar to those of Basic, Pascal, and C.
  63.  
  64. 1.4. General editing instructions
  65.  
  66. In general, you will use either the keyboard or the mouse to enter an expression. As you type (or click) the expression will appear in a text box. By pressing the return key on the keyboard you will tell the computer to evaluate the expression.
  67.  
  68. This calculator does not work like the simple credit-card calculators. If you type "3 * 2 +" on such a calculator, the expression "3 * 2" will be evaluated in the instant that you press the "+" key, resulting in a "6" in the display window. The Extended Calculator will not calculate any part of the expression until you press the return key.
  69.  
  70. 1.5. Using multiple calculators
  71.  
  72. This program offers not one, but four separate calculators, this makes it possible for the program to offer both simplicity and power as well as a wide range of different functions.
  73.  
  74. You open a calculator by choosing its name from the Calculators menu. All the calculators can be open at the same time. You select the calculator you want to work with by clicking its window or selecting its name from the Calculators menu.
  75.  
  76. It should be noted, that the four Calculators should be considered only as different interfaces to the same set of data and functions. Thus, it is possible to write a program using the Layman's calculator, it will be an awesome task, though, since its interface wasn't designed for that purpose. 
  77.  
  78. At any given time, you should use the one of the four calculators that seems to make the most sense, considering the particular problem you are trying to solve.
  79.  
  80. 2. The Menu Options
  81.  
  82. 2.1. The Apple menu
  83.  
  84. About The Extended Calculator
  85. -----------------------------
  86. This option shows a nice picture with some information about the program.
  87.  
  88. 2.2. The File menu
  89.  
  90. Quit
  91. ----
  92. Selecting Quit from the File menu will, as usual, terminate the application.
  93.  
  94. 2.3. The Edit menu
  95.  
  96. Undo, Cut, Copy, Paste, Clear
  97. -----------------------------
  98. These options works as usual, with the exception that most of the time, Undo is not available. I know leaving out the Undo command isn't very Macintosh. Are you complaining? Pay your ShareWare fees, and I'll see what I can do about it.
  99.  
  100. 2.4. The Calculator menu
  101.  
  102. This menu enables you to select between the various calculators supplied by this program. You simply pick the calculator you want to work with from the menu. If the calculator's window is closed it will be opened, otherwise it will just be brought to front.
  103.  
  104. 2.5. Calculator specific menus
  105.  
  106. In addition to the menus described above, each calculator may also have one or more menus of its own. (Menus that only appear when that calculator is active.) For information about those menus, I refer to the sections dealing with each one of the calculators.
  107.  
  108. 3. The Layman's Calculator
  109.  
  110. 3.1. The window
  111.  
  112. The window of the Layman's calculator contains a box where the calculations together with their results appear and a total of twenty keys. You can use the box as a normal text edit field, that is, you can type in an expression, use the mouse to select parts of it, cut, copy and paste, just as you are used to from any word processing application.
  113.  
  114. If you don't want to use the keyboard, you can use the mouse to click on the keys of the calculator. Clicking a number or the period will make that number appear in the display box. Clicking ( ) √ * + - or ÷ will make the appropriate symbol appear in the display window. If you press ÷, the / symbol will appear, because this is the preferred symbol for division. (However, if you use the keyboard to type ÷, the computer will understand that this also is an expression for division.)
  115.  
  116. The key labeled EXP is used for entering very large or very small numbers using scientific notation. When you press the key EXP the capital letter E will appear in the display window. This E should be thought of as the *10^ you use when you write numbers in scientific notation. Thus 1E3 is the same as 1000 and 12E-3 is the same as 0.012. Note that although you can think of E as short for *10^, the letter E can only be used for entering numbers in scientific notation, not for a general calculation involving *10^. Expressions like 1E2.5 or 1E(2+3) will not be interpreted as 10^2.5 and 10^(2+3), but instead as 1E2 = 100 and 1E2 + 3 = 103 respectively. Also note that only the capital E can be used for this purpose, e is a symbolic constant ≈ 2.7182.
  117.  
  118. The key labeled = is as usual used for triggering the calculation. The same result can be obtained by pressing the return key in the display box. Note that pressing the = key on the keyboard will not produce this result, but instead result in a = in the display box. This is because the calculator uses = as a logical operator. (For an explanation see the functions reference, section 7.8) This may seem confusing, but on most simple calculators pressing the key = means "evaluate the expression", and I didn't want to interfere with this. If you are using the Scientific Calculator you will find that the key that means "evaluate the expression" is labeled as a return key. This is because the Scientific Calculator is aimed toward more advanced users.
  119.  
  120. 3.2. Entering an expression
  121.  
  122. As mentioned several times earlier there are basically two ways of entering an expression. You can use the keys on your keyboard or you can click on the keys displayed in a calculator's window. Which one to prefer is a matter of taste, although using the keyboard usually is faster. There is also the possibility of pasting in an expression from another program (or from this manual) directly into the display box.
  123.  
  124. There might be a difference between the Layman's Calculator and the calculator you are used to. Most simple calculators perform operations directly. If you press 9 and then the square root key the calculator will instantly calculate √9 and display the result 3 in its display window. This calculator will however gather the keystrokes to an input string (which will be displayed in the display window) and not perform any calculations until you order it to (by pressing the = key on the calculator or the return key on your keyboard).
  125.  
  126. This means that if you press 9 and then the square root key the computer will display 9√, this is probably not what you intended. Pressing the √ key first and then the 9 key will give the correct result √9.
  127.  
  128. You use the parentheses to delimit parts of the expression that will be calculated before other parts. If you write 9*3+2 the calculator will multiply 9 by 3 and than add 2. By convention an expression with * will always be calculated before an expression with +. * is said to have higher operator precedence than +. (^ has still higher precedence so if you write 2*2^3 the computer will raise 2 to the power of 3 and then multiply the result by 2.) Suppose that this is not what you wanted. Suppose that you wanted to first add together 3 and 2 and then multiply the result by 9. In this case you would put 3 + 2 in parentheses to get the expression 9*(3+2) which will evaluate to 45, the result you wanted. 
  129.  
  130. 3.3. Using the results of calculations
  131.  
  132. When you need to use the result of a calculation, for example in a word processing document, you can type it of from the calculators window. A better method is sometimes to use the standard Cut, Copy and Paste commands provided by most Macintosh applications. Select the result you want to use and choose Cut or Copy, then switch to the word processing program and choose Paste.
  133.  
  134. 4. The Scientific Calculator
  135.  
  136. 4.1. The window
  137.  
  138. The Scientific calculator contains two display windows and two keyboards, one with big keys in the right half of the calculator, one with smaller keys in left half.
  139.  
  140. The upper window is used for entering expressions to be evaluated. The results of the calculations or any errors that occurred while calculating will be displayed in the lower window. If you enter an expression in the lower window and try to calculate it you won't get any result.
  141.  
  142. Clicking one of the calculator's keys will make the expression corresponding to the key appear in the display window, at the position of the caret. For a description of the different functions provided by the calculator I refer to the Functions reference part of this manual, section 7.
  143.  
  144. The expressions that appear when you press a key will not always look as the label of the key. Pressing "EXP" will display "E", pressing the key labeled something like "y√x" will display "^(inv(". (The reason for this is that the √ sign is only used to evaluate square roots so 3√27 would not be interpreted as the third root of 27, which is 3, but instead as 3 times the square root of 27, which is 15.58.) So don't be surprised if the expressions displayed does not adhere to the letter of the label, they will in all cases adhere to its spirit.
  145.  
  146. When you press the key corresponding to a function with only one argument, only the function name will appear. Pressing the sin key will display "sin". However, when you press the key of a function taking several arguments, dummy arguments will appear. For example pressing the round key, will display: "round(x, noDecimals)". The reason for this is that when a function takes several arguments it could be painful to try to remember their order (should the number of decimals go before the value I was rounding off or should it go after?). The dummy arguments should of course be replaced with the real expression you want to evaluate. If you try to evaluate round(x, noDecimals) directly, you will get an error, since the calculator doesn't know of the word "noDecimals".
  147.  
  148. 4.2. Using complex numbers
  149.  
  150. While the Scientific Calculator does not fully support complex numbers (for example, it does not support raising a complex number to an arbitrary exponent or raising e to an arbitrary complex number) it is able to perform some simpler operations on them. (Adding, subtracting, multiplying, dividing, calculating their absolute and congruent values, their real and imaginary part.) This entry will only describe how complex functions are used on this calculator, not the functions themselves. For a description of those I refer to the Function Reference section, part 7.2, of this manual.
  151.  
  152. A complex number consists of a real and an imaginary part. In ordinary mathematics complex numbers are written 2 + 3i, 4 - 5i and so on, where i is the imaginary unit √(-1). The Extended Calculator does not support this use of i (in the Extended Calculator i is one of the 25 single letter variables). A complex number in the Extended Calculator is instead written (real_part, imaginary_part). The numbers above would thus be written (2,3) and (4,5).
  153.  
  154. The complex arithmetic functions look like their real value counterparts but are followed by an apostrophe '. Thus to use the Extended Calculator to calculate (2+2i)/(-2-i) you would write. (2,2)/'(-2,-1), with the result (-1.2, -0.4). 
  155.  
  156. Note that only the Scientific Calculator can display complex numbers as the result of a calculation. If you use the Layman's calculator only the real part of the complex number will be displayed. Therefore, when you are fiddling with complex numbers, stick to the Scientific Calculator.
  157.  
  158. 4.3. Using variables
  159.  
  160. If you have used the M, RM, M+ and M- functions on an ordinary calculator, you are already familiar with the concepts of variables. A variable is a place where you store the result of a calculation to later retrieve it for use in another calculation. In this sense a variable may be thought of as a container with place for a number.
  161.  
  162. 4.3.1 Variables available
  163. -------------------------
  164. The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e ≈ 2.718…) gives access to a separate storage place for a number.  The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus, mem(2) is one variable and mem(3) another. The function mem(x) gives you access to 100 different variables, each which may contain it's own number. If you write mem(101), you will get an error, because only 100 storage places are reserved for the function mem(x).
  165.  
  166. 4.3.2 Storing something in a variable
  167. -------------------------------------
  168. You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
  169.  
  170.    a:=sin(π) ^ 2
  171.    mem(37):=2 ^ (3 + 3 cos (1/2))
  172.  
  173. Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
  174.  
  175. 4.3.3 Using a variable's value
  176. ------------------------------
  177. To use the value stored or put in a variable, simply use the variables name in the calculation. Examples:
  178.  
  179.    cos(mem(37))
  180.    sin(a)^mem(37)
  181.    a:=a+1
  182.    mem(mem(1)):=y^(mem(x))
  183.  
  184. Try to understand what each one of these statements actually does.
  185.  
  186. 4.4. Doing multiple calculations
  187.  
  188. The facility that makes the Scientific calculator able to display complex numbers in its lower display window also makes it possible to calculate a number of expressions at the same time, displaying all the results simultaneously in the result window. 
  189.  
  190. To use this facility, simply separate each calculation with the comma delimiter, for example, writing "2+3,2*3" and pressing return will make the result "(5, 6)" appear in the lower window.
  191.  
  192. 4.5. Using reverse polish notation
  193.  
  194. Reverse polish notation (usually abbreviated RPN) is a method for writing any expression without the use of parentheses. A thorough explanation of the concept of RPN is given in the Technical Reference section, section 10, of this manual.
  195.  
  196. The Extended Calculator converts the expression you type to RPN before evaluating them, the reason for this is that while ordinary notation might be more natural to you, RPN is more natural to the computer. Because of this, there is usually no need to write an expression in RPN, ordinary notation is generally superior. There might however be a rainy day when you want to try RPN for experimental purposes or just for the sheer fun of it.
  197.  
  198. To write an expression in RPN with the Scientific calculator all you have to do is to separate each element with a comma, thus if you wanted to calculate 5^((3+2)*4) using RPN you would simply write:
  199.  
  200.     3,2,+,4,*,5,^
  201.  
  202. Well, maybe not so simply, but isn't it FUN?
  203.  
  204. 5. The Graph Drawer
  205.  
  206. 5.1. The window
  207.  
  208. The window of the Graph Drawer is automatically redrawn in the background when you remove some element in the foreground so that other parts of the Graph Drawer's window show up. Since some graphs take quite a time to plot, this may cause a disturbing delay. To avoid this, don't have the Graph Drawer running in the background while using another calculator.
  209.  
  210. The window of the Graph Drawer contains the following elements:
  211.  
  212. The graph window
  213. ----------------
  214. This is where the graph will be displayed. It contains one or two graphs together with the x- and y-axis and occupies most of the Graph Drawer window.
  215.  
  216. The scroll arrows
  217. -----------------
  218. There are four scroll arrows to the left and to the right of the graph. These are used for scrolling the graph vertically and horisontally. For more information about scrolling see section 5.6 on Zooming and scrolling.
  219.  
  220. The origin button
  221. ----------------
  222. The origin button is placed in the lower right corner of the graph. It looks like a plus sign. Pressing the origin button will take you to the default view, which is the view that is used when the Graph Drawer is opened. This default view is centered about the origin with x ranging from -10 to 10 and y ranging from -5 to 5. You can change the default view using the Set Default View menu option, see section 5.2.
  223.  
  224. The zoom in button
  225. ------------------
  226. The zoom in button is situated in the lower right corner of the graph. It looks like a sine curve in close-up. Clicking it will zoom in on the center of the graph. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
  227.  
  228. The zoom out button
  229. -------------------
  230. The zoom out button is just to the left of the zoom in button and looks like a sine curve. Clicking it will zoom out. For more information see section 5.6 on Zooming and scrolling.
  231.  
  232. The zoom to selection button
  233. ---------------------------
  234. The zoom to selection button is situated just above the other two buttons. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
  235.  
  236. The graph specific controls
  237. ---------------------------
  238. Below the graph window are a number of controls. The appearance of these controls is specific to each one of the graphs and is therefore described in the section on each of the graphs.
  239.  
  240. The current coordinate display
  241. ------------------------------
  242. In the lower left corner of the Graph Drawer's window is a coordinate displayed. This coordinate is the coordinate corresponding to the current mouse position. You can move the mouse to parts of the curve to find out their coordinates. This is useful, for example for finding approximate max and min values.
  243.  
  244. 5.2. The Graph menu
  245.  
  246. Set Range
  247. ---------
  248. Set Range brings up a dialog box which allows you to specify which part of the graph you want to view. You type in the minimum and maximum values of x and y that you want to use and press OK.
  249.  
  250. Zooming Options
  251. ---------------
  252. Zooming Options brings up a dialog box that let's you specify how the different zoom buttons will work. For more information about this see section 5.6 on Zooming and scrolling.
  253.  
  254. Set Default View
  255. ----------------
  256. Set Default View will select the current view as the default view. If you zoom in, out and scroll, you can always return to the default view by pressing the cross-hair control in the lower right corner of the graph window.
  257.  
  258. Same Scaling x/y
  259. ----------------
  260. After you have zoomed to a selection several times the graph may be stretched or compressed horisontally or vertically, because the zoom window wasn't the same shape as the graph window. Choosing this menu option will correct this problem by forcing the same scaling upon the x- and y-axis.
  261.  
  262. Copy Graph
  263. ----------
  264. Selecting this option will put a copy of the graph in the clipboard. The copy can be pasted into a word processing program or a drawing program.
  265.  
  266. Find Intersection
  267. -----------------
  268. For more information about this option see the separate section on finding intersection, 5.7.
  269.  
  270. Numerical differentiation
  271. --------------------
  272. This option is described in section 5.8.
  273.  
  274. Numerical integration
  275. ---------------------
  276. This option is described in section 5.9.
  277.  
  278. Normal
  279. ------
  280. This option allows you to draw ordinary graphs, see section 5.3.
  281.  
  282. Polar
  283. -----
  284. This option allows you to draw polar graphs, see section 5.4.
  285.  
  286. Parametric
  287. ----------
  288. This option allows you to draw parametric graphs, see section 5.5.
  289.  
  290. 5.3. Ordinary graphs
  291.  
  292. An ordinary graph consists of all pairs of points (x,y) that solves an equation of the type y=f(x). Each value of x is associated with one value of y.
  293.  
  294. The ordinary graph drawer can draw two graphs, one consisting of all points (x,y) that solves the equation y=f(x) and one consisting of all points (x,z) that solves the equation z=g(x).
  295.  
  296. The ordinary graph window has two boxes where you can enter the two functions that will be plotted. The entries should be of the type y:=f(x) and z:=g(x), where f(x) and g(x) are the two functions you want to plot. If you want to plot a sine curve and a cosine curve at the same time, you would write "y:=sin x" in the upper box and "z:=cos x" in the lower box.
  297.  
  298. The ordinary graph window also contains a check box labeled Shadow if undef. Some functions are not defined for all values of x. For example √x is only defined as a real number when x is positive or zero. Normally the graph drawer will simply skip the parts of the graph that are undefined, selecting this option will instead make the graph drawer shadow those parts of the graph, making it easy to see exactly the parts that are undefined. If a function is undefined in specific singular points (like 1/sin x), the Graph Drawer will usually fail to detect these points, this is because detecting such points requires a thorough examination of the functions involved, using calculus.
  299.  
  300. Note that when plotting two functions only the part where BOTH the functions are well defined will be drawn. Thus if you draw √x and sin x, you will only see the right half of the sine curve, although sine is defined for all real values of x.
  301.  
  302. 5.4. Polar graphs
  303.  
  304. A point in the plane can be specified by the ordinary rectangular coordinates (x,y), x being the perpendicular distance from the y-axis and y being the perpendicular distance from the x-axis. Another way of specifying a point in the plane is by the distance from the function to the origin and the angle that a line from the point to the origin makes with the positive x-axis. If you plot all the points satisfying the equation r = f(t), where r is the distance from the origin to the point and t is the angle a line from the point to the origin makes with the positive x-axis you will get a polar curve. Thus, r = 2 would represent a circle of radius 2.
  305.  
  306. The polar curve window has a box which let you specify which equation you want to use. You enter the equation as r := f(t), where f(t) is the polar function you want to plot. For example to draw a spiral you could write "r := √ t" in the box.
  307.  
  308. The three boxes below are used to control which part of the curve is drawn and how carefully. An ordinary graph has only one point for each x-value so when you are drawing it you only have to step through each x-value in the graph window and plot the corresponding y-value. A polar graph may however loop back into itself, making it hard to determine which parts of the graph that will end up in the graph window. (Consider the graph r := 1/t close to the origin.) Therefore, there must be some way of determining which parts of the graph will be drawn.
  309.  
  310. t-min is the first value for which the function will be plotted, t-max is the last value and Steps is the number of measurements that will be taken along the path. Usually t-min will be 0 and t-max 3.14 or 6.28. Note that you cannot enter an arithmetic expression (such as 2π) into these boxes, only numbers will do. The larger the number of steps you use the longer it will take to draw the curve, but the less jagged it will be.
  311.  
  312. If you have specified an enormous number of steps and the time it takes to draw the graph becomes unbearable, you can interrupt the process by holding down the command key and pressing the period (.). This will interrupt any calculation the Extended Calculator is busy with.
  313.  
  314. Note that although the Graph Drawer makes use of polar coordinates when drawing a polar graph, the coordinates displayed in the lower left part of the window will still be rectangular coordinates.
  315.  
  316. 5.5. Parametric graphs
  317.  
  318. A parametric graphs consists of all the points (x,y) in the plane satisfying x = f(t) and y = g(t) for some value t. Specifying separate values for x and y allows you to draw complex functions, like conic sections, easily. Often a useful way of thinking of parametric graph is to imagine t being a variable representing time (although this is by no means necessary). The graph will then be the path traced out by a point traveling so that its x-coordinate at any given time t is f(t) and its y-coordinate at any given time t is g(t).
  319.  
  320. In the box of the parametric equation you enter the two equations for x and y separated by a semi-colon. Thus entering "x := 2 cos t; y := 2 sin t" will produce a circle of radius 2.
  321.  
  322. As with the polar graph (and for the same reasons) the three boxes below are used for determining which parts of the graph that will be drawn and with what accuracy. If we use the time-analogy again, this specifies between which times the path of the particle will be traced and how many samples of the particle's position that will be taken along the path.
  323.  
  324. 5.6. Zooming and scrolling
  325.  
  326. To specify which part of a graph you want to look at you use the zooming and scrolling options to set the x-min, x-max, y-min and y-max of the graph window.
  327.  
  328. The most direct way do this is by selecting Set Range from the graph menu, this however, requires that you know exactly what part of the graph you want to look at, and even then it is not always the fastest option.
  329.  
  330. The scrolling arrows allow you to scroll along the graph to see how it changes. Since scrolling of the graph requires the graph to be redrawn, scrolling graphs often appears sluggish. Scrolling an ordinary graph vertically or scrolling polar or parametric graphs is often especially slow, since it requires the entire graph to be redrawn. Although slow, scrolling may still be useful under some circumstances.
  331.  
  332. The default view button, next to the down and right scroll arrows, which resembles a + will take you to a default view. When you start up the application this default view will be set to x ranging from -10 to 10 and y ranging from about -5 to about 5. You can however change the default view by specifying a new default view in the Zooming Options dialog, or choosing the Set Default View option when you have a pleasing view.
  333.  
  334. The zoom in button (resembles a sine curve in close-up) will zoom in towards the center of the graph. The default zooming is set to 200 %, you can however change this by using the Zooming Options dialog.
  335.  
  336. The zoom out button (resembles a sine curve) will zoom out of the graph. The default zooming is set to 25 %, but can be changed using the Zooming Options dialog box.
  337.  
  338. The zoom to selection button (above the other zoom buttons) zooms in to a part of the graph that you have selected. You select a part of the graph by dragging with the mouse (a flashing rectangle will appear). Clicking the zoom to selection button will zoom in so that the part you selected covers the entire graph window.
  339.  
  340. If you have used the zoom to selection button or the Set Range option you may have stretched the graph in some direction (so that a line making 45° with the x-axis in the actual graph will make another angle with the x-axis in the drawing in your window). Sometimes this doesn't matter, but sometimes you want to use the same scaling on the x- and y- axis. Selecting Same Scaling x, y will take care of this.
  341.  
  342. 5.7. Finding intersections
  343.  
  344. When you are using the ordinary graph drawer and have two graphs in the same window you can use the menu option Find Intersection, to find a point where the two graphs intersect. Note that you cannot use this to find the point where a graph intersects one of the coordinate axis, unless you set one function to be y := 0.
  345.  
  346. To find the intersection of two curves, drag with the mouse to select the part where the two curves intersect and select Find Intersection from the graph menu. The Graph Drawer will use the bisection method to find the point where the two curves intersect. If the two curves do not intersect in the selection you have made or if they intersect more than once, you will get an error message.
  347.  
  348. 5.8. Numerical differentiation
  349.  
  350. The Graph Drawer will automatically perform numerical differentiation on the graph for you. Select Numerical Differentiation from the graph menu and specify in which x-value you will differentiate (or in which t-value, for parametric and polar graphs) and the Graph Drawer will calculate a numerical derivative. If you have selected a part of the curve, the left limit of the selection will be used as a prompt in the differentiation dialog.
  351.  
  352. To do this it adds a tiny fraction to x, calculates y, then subtracts the tiny fraction from x and calculates a new y-value. It then divides the difference between the values with twice the tiny fraction. 
  353.  
  354. For polar and parametric curves the numerical differentiation will not calculate dx/dt, dy/dt or dr/dt, but dy/dx in the point t, that is, the slope of the curve in that point.
  355.  
  356. 5.9. Numerical integration
  357.  
  358. The Graph Drawer will automatically perform numerical integration for you. Select a part of the graph by clicking and dragging and select Numerical Integration from the Graph menu. This will bring up a dialog box, which lets you specify the integration limits and how many steps will be used for the calculation.
  359.  
  360. To calculate the integral, the calculator uses Simpson's formula for ordinary graphs and the trapezoid formula for polar and parametric graphs.
  361.  
  362. Note that for polar and parametric graphs the integral calculated is not ∫x dt, ∫y dt or ∫r dt, but ∫y dx when t ranges from the lower integration limit to the upper.
  363.  
  364. Note that if a parametric or polar curve goes in the negative x direction and y is positive this integral will be negative (since the differential dx will be negative).
  365.  
  366. 6. The Programmable Calculator
  367.  
  368. 6.1. The window
  369.  
  370. The window of the programmable calculator contains one big field which is used for entering the program, a scroll bar to the left for scrolling through the program, a size box in the lower left corner for adjusting the size of the window and an information bar at the bottom of the window.
  371.  
  372. The information bar displays how many memory units that are occupied by the program. There are 1000 units available. If you use up all these units, tough luck. A future version of the Extended Calculator might be able to run your program, but this one won't. It is worth saying once again that the Extended Calculator is intended for small programs for mathematical or humorous purposes (whichever comes closer to your heart), not for large scale programming. 1000 units is in fact sufficient for most programs you will want to write.
  373.  
  374. The information bar also displays the value of the common variables a, b, c, x, y, z. Sometimes it is convenient to store the results of a program in one of these variables and just reading the value from the information bar when the program is done, rather than bringing up a dialog box presenting the result.
  375.  
  376. 6.2. The Programmable menu
  377.  
  378. Run
  379. ---
  380. Run tells the computer to start executing the program beginning with the first line and continuing downwards. If the program seems to get stuck in an infinite loop or something, you can hold down the command key and press the period to halt program execution.
  381.  
  382. Open
  383. ----
  384. Will open a previously saved program or any other text file and display the result in the programming window.
  385.  
  386. Save
  387. ----
  388. Will save the program you are working on under it's current name. If it doesn't have one the standard dialog box will allow you to baptize and place it.
  389.  
  390. Save As
  391. -------
  392. Will bring up the standard dialog box for saving and allow you to enter a name and select a location where the program will be saved.
  393.  
  394. 6.3. General editing instructions
  395.  
  396. You enter the program in the same way as you enter any text file. In fact, you can if you wish, use another editor than the Extended Calculator (such as your favorite word processing program) for entering the program, save it as a text file and then open it from the calculator.
  397.  
  398. One difference between this editor and the usual ones is that pressing the tab key in this editor will produce four spaces in a row. This is useful, since it is considered good programming style to indent the lines affected by a program flow controlling statement, such as below:
  399.  
  400.    while (x<100);
  401.        x:=x+1;
  402.        beep;
  403.    end;
  404.  
  405. The Extended Calculator is case sensitive, but does not care about spaces or line feeds.
  406.  
  407. When you have finished editing the program, select Run from the Programmable menu and program execution will start. If the program gets stuck in a loop holding the command key and pressing a period (.) will halt execution.
  408.  
  409. 6.4. Programming vs. calculation
  410.  
  411. Assuming you know how to use the Extended Calculator for ordinary calculations, how do you get started with programming? In fact the big difference between programming and calculating is not that big. A program may be considered simply to be a long calculation. Indeed, the Extended Calculator makes no difference between programs and other calculations, they are treated in exactly the same way. There are however three points worth mentioning on this issue.
  412.  
  413.  1. A program contains more than one statement
  414. -----------------------------------------------
  415. A statement should be thought of as an instruction to the computer, it is comparable to the sentence in ordinary languages . Ordinary calculations contain only a single statement, like sin(π/6)^2, most programs will however contain several statements. The statements are separated by a semi-colon ;. Usually each statement begins a new line, although this is not necessary. Thus if you write:
  416.  
  417.    sin (3);
  418.    2+6*12;
  419.  
  420. in the window of the programmable calculator and select Run, the computer will first calculate sin(3) and then proceed to the next line and calculate 2+6*12. Check out the sample programs to get a better idea of how this works.
  421.  
  422.  2. A program makes use of variables
  423. -------------------------------------
  424. You may use variables in other calculations, but variables are (often) crucial to a program. If you have used an ordinary table calculator you will probably have made use of its memory functions (M, M+, M- and RM) to store and retrieve information. A variable may be thought of as one such memory location. The extended calculator gives you access to 125 such variables (through the letters a - z and the function mem). Each of these may contain a different value.
  425.    What makes variables crucial to programming is that whatever result one statement produces is lost when the computer proceeds to the next statement. If you run the sample program above, the computer will first calculate sin(3), it will then forget whatever the result of this calculation was and proceed with calculating 2+6*12, when that is done, it will forget the result and continue with the next statement, so this program won't do you much good. If you want to keep the results of a calculation you must assign them to a variable. After running the program:
  426.  
  427.    a:=sin(3);
  428.    b:=2+6*12;
  429.  
  430. the variable a will contain the value of sin(3) and the variable b will contain the value of 2+6*12.
  431.  
  432.  3. A program uses functions to control program flow
  433. -----------------------------------------------------
  434. Normally a program is executed line by line from the top to the bottom. Sometimes, however, this is not what you want. You may want the computer to perform a certain task repeatedly 200 times or you may want it to perform different tasks depending on the values of a variable. In these cases there are functions that let you control program flow. The space here does not allow for an explanation of the different kinds of control statements. Check out section 6.6 for a description of this.
  435.  
  436. 6.5. Using variables
  437.  
  438. A variable may be thought of as a memory location, or to be more physical, as a container where you can store a number. You can store the result of a calculation in a variable and retrieve it later to make use of it in another calculation.
  439.  
  440. 6.5.1 Variables available
  441. -------------------------
  442. The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e≈2.718…) corresponds to a certain location in the memory.  The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus mem(2) is one variable and mem(3) another. Thus, the function mem(x) gives you access to 100 different variables, each which may contain it's own number. If you write mem(101) you will have an error, because mem only gives access to 100 memory locations.
  443.  
  444. 6.5.2 Storing something in a variable
  445. -------------------------------------
  446. You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
  447.  
  448.     a:=sin(π) ^ 2;
  449.     mem(37):=2 ^ (3 + 3 cos (1/2));
  450.  
  451. Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
  452.  
  453. 6.5.3 Using a variable's value
  454. ------------------------------
  455. To use the value stored or put in a variable, simply use the variables name in the calculation. Examples:
  456.  
  457.     cos(mem(37));
  458.     sin(a)^mem(37);
  459.     a:=a+1;
  460.     mem(mem(1)):=y^(mem(x));
  461.  
  462. Try to understand what each one of these statements actually does.
  463.  
  464. 6.6. Controlling program flow
  465.  
  466. The Extended Calculator usually executes a program line by line, but sometimes you want it to do different things depending on the value of some variable or to perform a certain task repeatedly until a certain condition is satisfied. To do this you use functions that control program flow.
  467.  
  468. The Extended Calculator uses only two functions for controlling program flow. This is for two reasons. 1) Keeping the functions to a minimum reduces confusion and developing time. 2) Anything that can be done with the program flow can be done with these two functions, it may require some extra thinking though.
  469.  
  470. 6.6.1 The if - else - end construction
  471. ---------------------------------------
  472. The if function lets you perform some statements depending on the value of a variable (or some other condition). In your program, the statement will look like this:
  473.  
  474.   if (some condition);
  475.       lines that will be executed if the condition is true
  476.   else;
  477.       lines that will be executed if the condition is false
  478.   end;
  479.  
  480. It is possible to leave out the else statement and the lines following that (you must include the end, though, otherwise the computer won't know which lines are affected by the if-statement. A silly sample program using if might be:
  481.  
  482.   x:=message("Is it OK to beep?");
  483.   if (x=1);
  484.       beep;
  485.       message("Nice beep, huh?");
  486.   else;
  487.       message("OK, I'll keep quiet!");
  488.   end;
  489.  
  490. 6.6.2 The while-end construction
  491. -----------------------------
  492. The while end construction lets you execute some lines repeatedly while a certain condition is true. In your program it will look like this:
  493.  
  494.   while (some condition);
  495.       some lines that will be repeated
  496.   end;
  497.  
  498. An even sillier sample program than the one in section 6.6.1 might be:
  499.  
  500.   x:=message("Is it OK to beep?");
  501.   while(x=1);
  502.       beep;
  503.       x:=message("Wanna hear another beep?");
  504.   end;
  505.  
  506. 6.7. Comparison of control functions
  507.  
  508. The Extended Calculator's supply of expressions controlling program flow is small, nevertheless, using only these simple expressions, most common control structures can be mimicked. In this section we will look at some control structures from other languages and see how to implement them with the Extended Calculator's code.
  509.  
  510. 6.7.1 goto
  511. ----------
  512. There is no thing similar to the goto statement in the calculator's language. However, there is no situation where a goto statement is absolutely necessary. Many common languages, like C and Pascal, lacks a goto statement or discourages the use of it, since it often leads to bad programming style. If you are unsure of how to program without using goto, check out a primer on C or Pascal.
  513.  
  514. 6.7.2 gosub, functions
  515. ----------------------
  516. This program does not allow subroutines or the declaration of functions or procedures. If this was a program intended for writing big applications, this would of course be a major flaw. This program is however intended for small-scale programming, which is quite possible without the declaration of functions. Anything that normally would have been a function you will have to type out to its full length everywhere it would be used.
  517.  
  518. 6.7.3 else if
  519. -------------
  520. This program does not have an else if statement. You can however easily write code that behaves exactly like such a statement, for example:
  521.  
  522.     if (a);
  523.         (do something);
  524.     else if (b);
  525.         (do something else);
  526.     end;
  527.  
  528. would in the language of the Extended Calculator be written as:
  529.  
  530.     if (a);
  531.         (do something);
  532.     else;
  533.         if (b);
  534.             (do something else);
  535.         end;
  536.     end;
  537.  
  538. or maybe as:
  539.  
  540.     if (a);
  541.         (do something);
  542.     end;
  543.     if (not(a) && b);
  544.         (do something else);
  545.     end;
  546.  
  547. 6.7.4 switch, case
  548. ------------------
  549. The switch and case statements in C and Pascal (somewhat similar to the ON x GOSUB statement in Basic), can easily be emulated using a series of if-statements.
  550.  
  551.     switch(x) {
  552.         case 1:
  553.             doSomething;
  554.             break;
  555.         case 2:
  556.             doSomethingElse;
  557.             …
  558.  
  559. would be written as:
  560.  
  561.     if (x=1);
  562.      doSomething;
  563.     end;
  564.     if (x=2);
  565.      doSomethingElse;
  566.           …
  567.  
  568. 6.7.5 for, next
  569. ---------------
  570. A for-next statement can be simulated using the while construction, for example…
  571.  
  572.     for (x=1; x<10; x++)
  573.         doSomething;
  574.  
  575. would be written as
  576.  
  577.     x:=1;
  578.     while (x<10);
  579.         doSomething;
  580.         x:=x+1;
  581.     end;
  582.  
  583. 6.8. Getting data from the user
  584.  
  585. If you want a program to be flexible you must have some way of getting data from the user, data that you later can use in the program.
  586.  
  587. 6.8.1 Getting Data From Dialogs
  588. -------------------------------
  589. message ("some text")
  590.  
  591. The message functions provides a way of getting simple validation (OK or Cancel). Calling message() will bring up a dialog with the text between the quotation marks. If the user clicks OK the function will return 1, if the user clicks Cancel it will return 2. The function show() (described in section 6.9.1) can be used in a similar fashion.
  592.  
  593. if (message("OK to beep")=1);
  594.     beep;
  595. end;
  596.  
  597. get ("some text", number)
  598.  
  599. This function is useful if you need the user to input a number. Calling get() will bring up a dialog displaying the text within the quotation marks. The number sent to the function will be displayed as a prompt in a box, where the user can enter a number. The function will return the number the user has entered.
  600.  
  601. w:=get("What is your weight in kilos",72);
  602.  
  603. 6.8.2 Getting Data From The Mouse
  604. ---------------------------------
  605. HMouse
  606.  
  607. This function will return the horizontal position of the mouse relative to the top left corner of the window.
  608.  
  609. VMouse
  610.  
  611. This function will return the vertical position of the mouse relative to the top left corner of the window. Unlike what you may be used to a higher number means the mouse is closer to the bottom of the screen.
  612.  
  613. button
  614.  
  615. This function will return 1 if the mouse button is being pressed and 0 if it is not being pressed.
  616.  
  617. 6.9. Displaying data to the user
  618.  
  619. There are several ways of displaying data to the user. The simplest way is to store the value you want to display in one of the variables a, b, c, x, y and z, the user can then easily read the value from the information bar when the program has ended.
  620.  
  621. 6.10. Presenting data in dialogs
  622. --------------------------------
  623. show ("some text", value)
  624.  
  625. This function will bring up a dialog box displaying the text within the quotation marks immediately followed by the value. If the user clicks OK the function will return 1, if he clicks Cancel it will return 2. This function is useful for displaying a single number as the result of a calculation, or as a way of getting data from the user. (See 6.8 Getting data from the user). If you just want to display a message and no value use the function message. (See Getting data from the user.)
  626.  
  627.     show ("The sine of 3 is: ",sin 3);
  628.  
  629. 6.11. Presenting data in a graphic window
  630. -----------------------------------------
  631. The Extended Calculator can bring up a graphic window where text, numbers and various graphic objects can be drawn. The functions for handling graphics are quite many and I refer to the sections Drawing 7.4, Printing text and numbers 7.11 and Window functions 7.17 of the Function Reference part of this manual, here I will just explain some of the functions.
  632.  
  633. text ("some text", left, top, right, bottom, alignment);
  634.  
  635. Draws the text within the quotation marks in the box determined by the coordinates. Alignment should be 0 - left alignment, -1 right alignment or 1 - center. You can use the functions TFont, TFace, TSize and TMode to determine the appearance of the text that will be drawn.
  636.  
  637. text ("You guessed right!",20,20,100,100,1);
  638.  
  639. drnu (value, left, top, right, bottom);
  640.  
  641.  This function is similar to text, the difference is that it draws a number instead of text. It draws the number value in the box specified by the coordinates. The functions TFont, TFace, TSize and TMode can be used to control the appearance of the text. 
  642.  
  643. 6.12. Sample programs
  644.  
  645. Here are some sample programs, which hopefully will help you understand the concepts presented in this section.
  646.  
  647. 6.12.1 Guessing game
  648.  
  649. "(uses 93 memory units)"
  650.  
  651. a:=random(1,100);
  652. h:=100;
  653. l:=0;
  654. x:=get("Guess a number between 1 and 100!",int((h+l)/2));
  655. n:=1;
  656. while (x<>a);
  657.     if (x<a);
  658.         l:=x;
  659.         x:=get("Wrong, guess higher!",int((h+l)/2));
  660.     else;
  661.         h:=x;
  662.         x:=get("Wrong, guess lower!",int((h+l)/2));
  663.     end;
  664.     n:=n+1;
  665. end;
  666. show("You finally got it right. Total number of guesses:",n);
  667.  
  668. 6.12.2 Mirror drawer
  669.  
  670. "(uses 91 memory units)"
  671.  
  672. a:=HMouse;
  673. b:=VMouse;
  674. while(not(button));
  675.     PPat(random(1,5));
  676.     x:=HMouse;
  677.     y:=VMouse;
  678.     line(a,b,x,y);
  679.     line(600-a,b,600-x,y);
  680.     line(a,300-b,x,300-y);
  681.     line(600-a,300-b,600-x,300-y);
  682.     a:=x;
  683.     b:=y;
  684. end;
  685.  
  686. 7. Function Reference
  687.  
  688. 7.1. Function glossary
  689.  
  690. Mathematically speaking a function is something that maps a set of input values (which may be real numbers, complex numbers or something you'd rather not hear about) to a set of output values.
  691.  
  692. In plain language a function works like the famous black box. You stuff something in one end and something pops out of the other end. The things you stuff in are usually enclosed in parenthesis after the functions name, sin(3), cos(2), but there are exceptions, like 2 * 3 or 4!. 
  693.  
  694. In computer jargon the things that are stuffed in are called "arguments", and the arguments are said to be "sent to the function". Whatever pops out is said to be "returned from the function". When you write sin(x) the argument x is sent to the function sin, which returns the sine of x. 
  695.  
  696. In a calculation the value of a function is the value it returns. If you write 2*sin(3), this might be read as: "2 times the value returned when the argument 3 is sent to the sine function", but why bother, when it is much simpler to say "2 times sine of 3".
  697.  
  698. Some functions (like PNormal) does not return any value, but instead, perform an action of some sort. Since such "functions" are not functions in the mathematical sense, some computer languages refer to them as procedures. Others, however, do not bother.
  699.  
  700. 7.2. Complex
  701.  
  702. (a, b) +' (c, d), (a, b) -' (c, d), (a, b) *' (c, d), (a, b) /' (c, d)
  703.     Complex arithmetic. 
  704.     (2, 3) *' (1, 2) = (2 + 3i) * (1 + 2i) = 2 + 7i + 6i^2 = -4 + 7i = (-4, 7).
  705.     Note that a complex number is always denoted (a, b), the program does not make use of the imaginary unit i. You cannot write 1 + 2i, you must write (1, 2).
  706.  
  707. cabs (a, b)
  708.     The absolute value of the complex number a + bi.
  709.     cabs (3, 4) = 5.
  710.  
  711. con (a, b)
  712.     The congruent number to the complex number a + bi.
  713.     con (3, 4) = (3, -4).
  714.  
  715. im (a, b)
  716.     The imaginary part of the complex number a + bi.
  717.     im(3, 4) = 4.
  718.  
  719. re (a, b)
  720.     The real part of the complex number a + bi.
  721.     re (3, 4) = 3.
  722.  
  723. angle (x, y)
  724.     The angle the line from the origin to the point (x, y) makes with the x-axis.
  725.  
  726. radius (x, y)
  727.     The distance from the point (x, y) to the origin.
  728.  
  729. x-coor (radius, angle)
  730.     The x-coordinate of the point with polar coordinates (radius, angle).
  731.  
  732. y-coor (radius, angle)
  733.     The y-coordinate of the point with polar coordinates (radius, angle).
  734.  
  735. 7.3. Dialogs
  736.  
  737. beep
  738.     Makes the computer beep.
  739.  
  740. get ("some text", number)
  741.     Displays the text "some text" in a dialog box and offers the user to input a number. The number passed to the function will be used as a prompt in the dialog box. The function returns the number the user types in the dialog box.
  742.     a:=get("Area of sphere:", 10).
  743.  
  744. message ("some text")
  745.     Displays the text "some text" in a dialog box. If the user clicks OK the function returns 1 if the user clicks Cancel, it returns 2.
  746.     g:=message ("Continue long calculation?")
  747.  
  748. show ("some text", a)
  749.     Displays the text "some text" together with the value a in a dialog box. If the user clicks OK the function returns 1, if the user clicks Cancel it returns 2.
  750.     show ("The result is", x);
  751.  
  752. 7.4. Drawing
  753.  
  754. PRect (left, top, right, bottom), FRect, IRect, ERect
  755.     Paints, Frames, Inverts or Erases a rectangle with the specified coordinates.
  756.     FRect (10,10, 100,100);
  757.  
  758. POval(left, top, right, bottom), FOval, IOval, EOval
  759.     Paints, Frames, Inverts or Erases an oval with the specified coordinates.
  760.     IOval (10, 40, 20, 100);
  761.  
  762. PArc(left, top, right, bottom, startAngle, angleSpan), FArc, IArc, EArc
  763.     Paints, Frames, Inverts or Erases an arc with the specified coordinates. The angles are measured in degrees. StartAngle is the angle where the computer will start drawing and angleSpan is the central angle of the arc. An angleSpan of 180 will produce a semi-circle, for example.
  764.     EArc (10, 10, 20, 20, 0, 90);
  765.  
  766. line (x1, y1, x2, y2)
  767.     Draws a line from the point (x1, y1) to the point (x2,y2).
  768.     line (10,10,100,100);
  769.  
  770. cls
  771.     Clears the drawing area.
  772.  
  773. PNormal
  774.     Sets the pen to the normal 1 x 1 pixel pen with black pattern.
  775.  
  776. PSize (h, v)
  777.     Sets the horizontal size of the pen to h and the vertical size to v.
  778.  
  779. PMode (x)
  780.     Sets the penmode to x. x must be one of the following values:
  781.     08 = copy the pen's pattern to the drawing
  782.     09 = or the pen's pattern with the drawing
  783.     10 = xor the pen's pattern with the drawing
  784.     11 = bic the pen's pattern with the drawing
  785.     12 = copy the pen's pattern to the drawing and invert
  786.     13 = or the pen's pattern with the drawing and invert
  787.     14 = xor the pen's pattern with the drawing and invert
  788.     15 = bic the pen's pattern with the drawing and invert
  789.  
  790. PenPat(x)
  791.     Sets the pen's pattern to x. x must be one of the following values:
  792.     1 = white
  793.     2 = light gray
  794.     3 = gray
  795.     4 = dark gray
  796.     5 = black
  797.  
  798. 7.5. Economic functions
  799.  
  800. fv (nper, amm, int)
  801.     Assuming you for nper periods pays the amount amm to a bank account or an other investment and that the interest has a grow factor of int for each period, this function calculates the future value.
  802.     If you are paying $5 each month to a bank account with 1 % interest per month, after 12 months you will have fv(12, 5, 1.01) on the bank account.
  803.  
  804. nper(fv, amm, int)
  805.     Assuming you are paying the amount amm each period to a bank account, and that the interest has a grow factor of int for each period, this function calculates how many periods required to achieve the sum fv.
  806.     You want to save $2000 by paying $20 each month to a bank account, to an interest of 1 % per month. This will take you nper(2000,20,1.01) months.
  807.  
  808. amm(fv, nper, int)
  809.     Assuming you make nper payments (one each period) to a bank account, with an interest grow factor of int each period, this function calculates the amount you have to pay each period if you want to have the amount fv by the end of the payments.
  810.    You want to save $2000 in 24 months on a bank account which pays 1 % interest per month. In that case, you will need to deposit amm(2000,24,1.01) each month.
  811.  
  812. 7.6. Exponential functions
  813.  
  814. exp (x)
  815.     Returns e^x, where e is the base of the natural logarithm.
  816.  
  817. ln (x)
  818.     Returns ln(x), that is the natural logarithm of x.
  819.  
  820. lg (x)
  821.     Returns lg(x), the 10-logarithm of x.
  822.  
  823. log(base, x)
  824.     Returns the logarithm of x, with base as base.
  825.  
  826. 7.7. Integer
  827.  
  828. com (n, k)
  829.     The number of combinations of n and k. The number of ways in which you can choose k elements of n if you are not concerned about the order,  n! / (k! (n - k)!).
  830.     com (5, 3) = 5! / 2! 3! = 10.
  831.  
  832. per (n) or n!
  833.     The number of permutations of n. The number of ways in which you can arrange n elements.
  834.     per (4) = 1 * 2 * 3 * 4 = 24.
  835.  
  836. random (lowLim, upLim)
  837.     A random integer between lowLim and upLim. 
  838.     random(1, 6) simulates an ordinary die.
  839.  
  840. 7.8. Logical functions
  841.  
  842. x and y, x & y
  843.     Returns the bitwise and of x and y.
  844.  
  845. x or y, x | y
  846.     Returns the bitwise or of x and y.
  847.  
  848. ~x
  849.     Returns the bitwise not of x.
  850.  
  851. not (x)
  852.     Returns the logical not of x.
  853.  
  854. x && y
  855.     Returns the logical and of x and y.
  856.  
  857. x || y
  858.     Returns the logical or of x and y.
  859.  
  860. 7.9. Memory functions
  861.  
  862. a - z
  863.     The single letters a to z are used as variables. (With the exception of e, which is a constant ≈ 2,718…). This means that they can be assigned values, which later can be used.
  864.  
  865. mem(x)
  866.     The function mem(x) provides access to 100 memory cells, which may be used as variables. The number x is an index that tells which of the 100 cells you are referring to it should be in the range [0, 99].
  867.  
  868. 7.10. Mouse functions
  869.  
  870. HMouse
  871.     The horizontal position of the mouse.
  872.  
  873. VMouse
  874.     The vertical position of the mouse.
  875.  
  876. button
  877.     Has the value 1 if the mouse button is currently being pressed and the value 0 otherwise.
  878.  
  879. 7.11. Printing text and numbers
  880.  
  881. text ("some text", left, top, right, bottom, alignment);
  882.     Draws the text "some text" in the box with the specified coordinates and the specified justification. The alignment must be one of the following values:
  883.     0 - align left
  884.    -1 - align right
  885.     1 - center
  886.  
  887. drnu (a, top, left, bottom, right)
  888.     Draws the number a in the specified rectangle.
  889.  
  890. TFace(x)
  891.     Sets the text face to x, where x may be one of the following:
  892.     00 - plain text
  893.     01 - bold
  894.     02 - italic
  895.     04 - underline
  896.     08 - outline
  897.     16 - shadow
  898.     32 - condense
  899.     64 - extended
  900. If you or-together several of these values all the styles corresponding to the values will be applied.
  901.  
  902. TMode(x)
  903.     Sets the transfer mode for drawing text to x, where x is one of the following:
  904.     1 - or the text with the drawing
  905.     2 - xor the text with the drawing
  906.     3 - bic the text with the drawing
  907.  
  908. TFont(x)
  909.     Sets the text font to x, the font numbers of some common fonts are:
  910.     00 - System font (Chicago)
  911.     01 - Application font (Helvetica)
  912.     02 - New York
  913.     03 - Geneva
  914.     04 - Monaco
  915.     05 - Venice
  916.     06 - London
  917.     07 - Athens
  918.     08 - San Francisco
  919.     09 - Toronto
  920.     11 - Cairo
  921.     12 - Los Angeles
  922.     20 - Times
  923.     21 - Helvetica
  924.     22 - Courier
  925.     23 - Symbol
  926.     24 - Mobile
  927.  
  928. TSize(x)
  929.     Sets the size of the text to x points.
  930.  
  931. 7.12. Program flow
  932.  
  933. if (a); [some lines] end;
  934.     If a is true, the lines before the end-command are executed, if a is false, the lines are skipped.
  935.     if (x>3); message ("x is bigger than 3"); end;
  936.  
  937. if (a); [part1] else; [part2] end;
  938.     If a is true, part1 is executed, if x is false, part 2 is executed.
  939.    if (x>3); message ("x is bigger than 3"); else; message("x is smaller than 3"); end;
  940.  
  941. while (a); [some lines] end;
  942.     If a is true the program executes the lines and when it reaches the end statement, loops back to the while statement, thus the lines may be executed many times, as the program loops in the while statement.
  943.     while (x<100); x:=x+1; end;
  944.  
  945. stop
  946.     Stops program execution;
  947.  
  948. 7.13. Real-value
  949.  
  950. abs (a)
  951.     The absolute value of a.
  952.     abs (-3) = 3.
  953.  
  954. arit(a, b, c)
  955.     The sum of the arithmetic series whose first term is a, second term is b and last term is c.
  956.      arit (1, 4, 16) = 1 + 4 + 7 + 10 + 13 + 16 = 51.
  957.  
  958. ceil (a)
  959.     The smallest integer that is bigger than or equal to a. 
  960.     ceil (π) = 4.
  961.  
  962. geom (a, b, c)
  963.     The sum of the geometric series whose first term is a, second term is b and last term is c.
  964.     geom (1, 2, 16) = 1 + 2 + 4 + 8 + 16 = 31.
  965.  
  966. int (a)
  967.     The largest number smaller than a.
  968.     int (3.5) = 3.
  969.  
  970. inv (a)
  971.     The inverse value of a.
  972.     inv (2) = 1/2 = 0.5.
  973.  
  974. limit(limit1, x, limit2)
  975.     If x lies between limit1 and limit2 this function will return x. If x is greater than the greater of the two limits, the function will return that limit. If x is smaller than the smaller of the two limits, the function will return that limit. This function is useful if you want to constrain a variable to a certain range. x := limit(0, x, 100).
  976.  
  977. max (a, b)
  978.     The greatest of the values a and b.
  979.  
  980. min (a, b)
  981.     The smallest of the values a and b.
  982.  
  983. pi or π
  984.     Constant that equals the ratio of the circumference of a circle to its diameter. pi ≈ 3.141…
  985.  
  986. rnd
  987.     A random value between 0 and 1.
  988.  
  989. round (a, b)
  990.     a rounded off at the b:th decimal place.
  991.     round (π, 2) = 3.14.
  992.  
  993. sgn (a)
  994.     The sign of a. -1 if a < 0, +1 if a >0.
  995.     sgn (-3) = -1.
  996.     The sgn function is normally not defined for 0, but for the sake of convenience, this program will use: sgn(0) = 1.
  997.  
  998. 7.14. Sign functions
  999.  
  1000. a + b, a - b, a * b, a / b
  1001.     Ordinary addition, subtraction multiplication and division.
  1002.  
  1003. a % b
  1004.     a modulus b, the rest you get when you divide a by b.
  1005.     10 % 7 = 3.
  1006.  
  1007. a \ b
  1008.     The integer part of the quotient a / b.
  1009.     10 \ 3 = 3.
  1010.  
  1011. a ^ b
  1012.     a raised to the power of b.
  1013.     2 ^ 3 = 8.
  1014.  
  1015. √ a
  1016.     The square root of a.
  1017.     √ 9 = 3.
  1018.  
  1019. a!
  1020.     The permutation of a.
  1021.     4! = 1 * 2 * 3 * 4 = 24.
  1022.  
  1023. a < b, a > b, a <= b, a ≤ b, a >= b, a ≥ b, a <> b, a >< b
  1024.     Comparing functions, has the numerical value 1 if the condition is satisfied, 0 otherwise. <= means "less than or equal to". <> and >< means "not equal to".
  1025.     (1 < 3) = 1, (2 <= 2) = 1, (3 <> 3) = 0, (2 = 1) = 0
  1026.  
  1027. variable := b
  1028.     Assigns the value b to the variable a.
  1029.     x := 3, assigns the value 3 to the variable x.
  1030.  
  1031. ( )
  1032.    Parentheses are used to separate parts of the calculation.
  1033.     3 * (2 + 3) = 15.
  1034.  
  1035. e
  1036.     Constant, the base of the natural logarithm.
  1037.     e ≈ 2.718…
  1038.  
  1039. π
  1040.     Constant, the ratio of the circumference of a circle to its diameter.
  1041.     π ≈ 3.141…
  1042.  
  1043. E
  1044.     Exponent, used when displaying numbers in scientific notation.
  1045.     2.3E+4 = 23000.
  1046.     Note that E should be thought of as a part of the number, and not as a function. That is, you cannot write 3E+x or 3E+(4+3). In these cases you must write 3*10^x and 3*10^(4+3), respectively.
  1047.  
  1048. ,
  1049.     Used for separating arguments to a function.
  1050.     FRect (0, 0, 100, 100).
  1051.  
  1052. ;
  1053.    Used for ending a statement when programming.
  1054.    x := 3;
  1055.  
  1056. 7.15. Time functions
  1057.  
  1058. tick
  1059.     The number of ticks (1/60ths of a second) since the system was last started up. The ticks can be used for timing by noticing the difference between the values returned by two different calls to tick.
  1060.  
  1061. 7.16. Trigonometric
  1062.  
  1063. sin (x)
  1064.     The sine value of x (in radians).
  1065.  
  1066. cos (x)
  1067.     The cosine value of x.
  1068.  
  1069. tan (x)
  1070.     The tangent value of x. tan (x) = sin (x) / cos (x).
  1071.  
  1072. cot (x)
  1073.     The cotangent value of x. cot (x) = 1 / tan (x).
  1074.  
  1075. sec (x)
  1076.     The secant value of x. sec (x) = 1 / cos (x).
  1077.  
  1078. csc (x)
  1079.     The cosecant value of x. csc (x) = 1 / sin (x).
  1080.  
  1081. asin (x)
  1082.     The arcsine value of x. sin (asin (x)) = x.
  1083.  
  1084. acos (x)
  1085.     The arccosine value of x. cos (acos (x)) = x.
  1086.  
  1087. atan (x)
  1088.     The arctangens value of x. tan (atan (x)) = x.
  1089.  
  1090. acot (x)
  1091.     The arccotangent value of x. acot (cot (x)) = x.
  1092.  
  1093. asec (x)
  1094.     The arcsecant value of x. sec ( asec (x)) = x.
  1095.  
  1096. acsc (x)
  1097.     The arccosecant value of x. csc ( acsc (x)) = x.
  1098.  
  1099. sinh (x)
  1100.     The hyperbolical sine of x.
  1101.  
  1102. cosh (x)
  1103.     The hyperbolical cosine of x.
  1104.  
  1105. tanh (x)
  1106.     The hyperbolical tangent of x. tanh (x) = sinh (x) / cosh (x).
  1107.  
  1108. deg (x)
  1109.     The number of degrees corresponding to x radians.
  1110.     deg (π/2) = 90.
  1111.  
  1112. rad (x)
  1113.     The number of radians corresponding to x degrees.
  1114.     rad (90) = π/2.
  1115.  
  1116. 7.17. Window functions
  1117.  
  1118. Window("Title", left, top, right, bottom, windowProc)
  1119.     Opens a window with the specified title and coordinates. The windowProc determines which type of window will be opened. It should be one of the following:
  1120.     00 - document window
  1121.     01 - dialog box 
  1122.     02 - plain dialog box
  1123.     03 - alternative dialog box
  1124.     04 - document without grow box
  1125.     08 - document with zoom box
  1126.     12 - document with zoom box but without grow box
  1127.     16 - black title bar, rounded corner window
  1128.  
  1129. Close
  1130.     Closes the program's drawing window.
  1131.  
  1132. Copy
  1133.     This command will copy everything that has been drawn by the program since the last call to Copy and put the result in the clipboard. It can then be pasted to the Scrap Book or to a word processing program. This is useful if you have used the calculator to create some appealing graphics.
  1134.  
  1135. 8. Formulas
  1136.  
  1137. This section of the manual contains a variety of formulas from mathematics, physics, chemistry, &c… It is of course not possible to cover every formula and every topic, but I have tried to include the information I found most useful. The formulas are designed to be used together with the Extended Calculator, so they are written in the calculators native language. If there are functions in these formulas that you do not understand I refer to the functions part of this manual, where all functions supported by the calculator are described.
  1138.  
  1139. To use these formulas together with the calculator, select the formula that you need and copy it to the Extended Calculator, then replace the text in the formula with the known values.
  1140.  
  1141. 8.1. Mathematics
  1142.  
  1143. Mathematical symbols used in this section:
  1144.  
  1145. +        Addition
  1146. -        Subtraction
  1147. *        Multiplication
  1148. / : ÷    Division (any of these will do)
  1149. √        Square root
  1150. ^        Power
  1151. !        Permutation
  1152. \        Integer division
  1153. %        Modulus
  1154. &&       Logical and
  1155. &        Bitwise and
  1156. ||       Logical or
  1157. |        Bitwise or
  1158. >        Greater than
  1159. <        Smaller than
  1160. =        Equal to
  1161. ≥ >=     Greater than or equal to
  1162. ≤ <=     Smaller than or equal to
  1163. ≠ <>     Not equal to
  1164. <=>      Equivalence
  1165. =>       Implicates
  1166.  
  1167. 8.1.1 Fundamental algebraic laws
  1168.  
  1169. a + b = b + a
  1170. a * b = b * a
  1171. (a + b) + c = a + (b + c)
  1172. (a * b) * c = a * b * c
  1173. a * (b + c) = a * b + a * c
  1174. a + c = b + c <=> a = b
  1175. a * c = b * c <=> a = b if c ≠ 0
  1176.  
  1177. 8.1.2 Approximations
  1178.  
  1179. • The error in an approximation is the difference between the approximation and the real value.
  1180. • A number f is said to be an error approximation if the absolute value of the error is less than or equal to f.
  1181. • The relative error is the quotient of the error and the approximation.
  1182. • The relative error approximation is the quotient of the error approximation and the approximation.
  1183. • When adding or subtracting two approximations, the error in the result is not greater than the sum of the errors in the approximation.
  1184. • When multiplying an approximation with a constant, the error in the result is not greater than the error in the approximation multiplied by the constant.
  1185. • When multiplying or dividing two approximations, the relative error in the result is approximately equal to the sum of the relative error approximations.
  1186. • Some useful approximations for small values of x are:
  1187.    1/(1 + x) ≈ 1 - x
  1188.    √(1 + x)  ≈ 1 + x/2
  1189.    sin x     ≈ x
  1190.  
  1191. 8.1.3 Algebra
  1192.  
  1193. 8.1.3.1 Quadratic laws, binomial theorem
  1194.  
  1195. (a + b)^2 = a^2 + 2ab + b^2
  1196. (a - b)^2 = a^2 + 2ab + b^2
  1197. (a - b) (a + b) = a^2 - b^2
  1198. a^3 + b^3 = (a + b)(a^2 - ab + b^2)
  1199. a^3 - b^3 = (a - b) (a^2 + ab + b^2)
  1200. (a + b)^n = com(0,n) a^n b^0 + com(1, n) a^(n-1) b^1 + com(2, n) a^(n-2) b^2 + … + com(n,n) a^0 b^n
  1201.  
  1202. 8.1.3.2 Solving Quadratic Equations
  1203.  
  1204. The roots to the equation ax^2 + bx + c, are given by:
  1205.     (-b + √(b^2 - 4ac))/2a        and
  1206.     (-b - √(b^2 - 4ac)/2a
  1207.  
  1208. 8.1.3.3 Fundamental Theorem of Algebra
  1209.  
  1210. If P(x) is a polynomial, then
  1211.     P(x) = (x - a) Q(x) + P(a)
  1212. Where Q(x) is a polynomial whose degree is one less than the degree of P(x).
  1213. Thus if P(a) = 0, P(x) is dividable by (x - a).
  1214.  
  1215. 8.1.4 Logarithms and Exponents
  1216.  
  1217. 8.1.4.1 Laws for Exponents
  1218.  
  1219. a^0 = 1
  1220. a^(inv(N)) = the Nth root of a
  1221. a^(-x) = inv (a^x)
  1222. a^x a^y = a^(x + y)
  1223. a^x / a^y = a^(x - y)
  1224. (a^x)^y = a^(xy) = (a^y)^x
  1225. a^x b^x = (ab)^x
  1226.  
  1227. 8.1.4.2 Definition of Logarithms
  1228.  
  1229. y = 10^x <=> x = log (10,y) = lg y
  1230. y = a^x <=> x = log (a, y)
  1231. y = e^x <=> x = ln y
  1232. ln y = ln 10 lg y
  1233. lg y = lg e ln y
  1234.  
  1235. 8.1.4.3 Logarithm Laws
  1236.  
  1237. log(c,x) + log(c,y) = log(c,xy)
  1238. log(c,x) - log(c,y) = log(c,x/y)
  1239. log(c,x^p) = p log(c, x)
  1240. log(a,x) = log(c,x)/log(c,a)
  1241.  
  1242. 8.1.5 Analytical geometry
  1243.  
  1244. 8.1.5.1 Midpoints
  1245.  
  1246. The midpoint of (a,b) - (x,y):
  1247.     ((a + x)/2, (b + y)/2)
  1248.  
  1249. The centre of a triangle (a,b), (c,d), (x,y):
  1250.     ((a + c + x)/3, (b + d + y)/3)
  1251.  
  1252. 8.1.5.2 Distances
  1253.  
  1254. The distance between the points (a,b) and (x,y):
  1255.     √((a - x)^2 + (b - y)^2)
  1256.  
  1257. The distance from the point (d,e) to the line ax + by + c = 0:
  1258.     abs(ad + be + c)/√(a^2 + b^2)
  1259.  
  1260. The distance from the point (e,f,g) to the plane ax + by + cz + d = 0 is given by:
  1261.     abs(ae + bf + cg + d)/√(a^2 + b^2 + c^2)
  1262.  
  1263. 8.1.5.3 Scalar Product
  1264.  
  1265. The scalar product of the vectors (a, b) and (x, y):
  1266.     ax + by
  1267.       or
  1268.     the length of the vectors multiplied by the cosine of the angle between the vectors.
  1269.  
  1270. The scalar product of (a, b, c) and (x, y, z) is:
  1271.    ax + by + cz
  1272.  
  1273. 8.1.5.4 Vector length
  1274.  
  1275. The length of the vector (x,y):
  1276.     √(x^2 + y^2)
  1277.  
  1278. The length of the vector (x,y,z):
  1279.     √(x^2 + y^2 + z^2)
  1280.  
  1281. 8.1.5.5 Angle between vectors
  1282.  
  1283. Cosine of the angle between the vectors (a,b) and (x,y):
  1284.  
  1285.     the scalar product of the vectors divided by the product of the vectors' lengths, that is:
  1286.  
  1287.     (ax + by) / (√(a^2 + b^2) √(x^2 + y^2))
  1288.  
  1289. The same holds in three dimensions, for the angle ß between (a, b, c) and (x, y, z) we have:
  1290.  
  1291.     cos ß = (ax + by + cz) / (√(a^2 + b^2 + c^2) √(x^2 + y^2 + z^2))
  1292.     
  1293. 8.1.5.6 Straight Lines
  1294.  
  1295. The line between (a,b) and (c,d) has the equation:
  1296.     y - b = ((d - b)/(c - a))(x - a)
  1297.  
  1298. A straight line can be written on the form:
  1299.     y = kx + m
  1300.  
  1301. A line through the point (a,b) parallel to the vector _v_ = (c, d) has the equation:
  1302.     (x, y) = (a, b) + t(c, d)
  1303.  
  1304. A line through the point (a, b, c) parallel to the vector _v_ = (d, e, f) has the equation:
  1305.     (x, y, z) = (a, b, c) + t(d, e, f).
  1306.  
  1307. 8.1.6 Calculus
  1308.  
  1309. 8.1.6.1 Increasing/Decreasing Functions
  1310.  
  1311. A function is on an interval I
  1312.   increasing if a > b => f(a) > f(b)
  1313.   decreasing if a > b => f(a) < f(b)
  1314. for all values of a and b in the interval I
  1315.  
  1316. 8.1.6.2 Local maximum and minimum
  1317.  
  1318. A function has in the point x
  1319.   a local maximum if f(a)<f(x)
  1320.   a local minimum if f(a)>f(x)
  1321. for all points a sufficiently close to x
  1322.  
  1323. 8.1.6.3 Derivative of Function
  1324.  
  1325. The derivative of a function f(x) is defined by:
  1326.     limes when h -> 0 of (f(x + h) - f(x))/h
  1327.  
  1328. 8.1.6.4 Finding Maximum and Minimum
  1329.  
  1330. A function is increasing if f'(x)>0 and decreasing if f'(x)<0.
  1331.  
  1332. If f'(a) = 0 and the sign shift close to a is
  1333.     + 0 -, then f(a) is a local maximum
  1334.     - 0 +, then f(a) is a local minimum
  1335.     + 0 +, then f(a) is a terrace point
  1336.     - 0 -, then f(a) is a terrace point
  1337.  
  1338. If f'(a) = 0 and f''(a)>0 then f(a) is a local maximum.
  1339. If f'(a) = 0 and f''(a)<0 then f(a) is a local minimum.
  1340.  
  1341. 8.1.6.5 Determining concavity
  1342.  
  1343. If f''(a)>0 the function is convex in the point a.
  1344. If f''(a)<0 the function is concave in the point a.
  1345. If f''(a) = 0 and if f''(x) in the vicinity of a shifts sign as - 0 + or + 0 -, then a is an inflection point of the curve.
  1346.  
  1347. 8.1.6.6 Mean Value Theorem
  1348.  
  1349. If f is differentiable in the interval [a,b] then there exists a c, such that:
  1350.     f(b) - f(a) = (b - a) f(c)
  1351.  
  1352. 8.1.7 Rules of Differentiation
  1353.  
  1354. 8.1.7.1 Arithmetic Operations
  1355.  
  1356. If f(x) and g(x) are differentiable then:
  1357. - - - - - - - - - - - - - - - - - - - - -
  1358. h(x) = f(x) + g(x) => h'(x) = f'(x) + g'(x)
  1359. h(x) = f(x) * g(x) => h'(x) = f(x)g'(x) + f'(x)g(x)
  1360. h(x) = f(x) / g(x) => h'(x) = (f'(x)g(x) - f(x)g'(x))/(g(x)^2)
  1361. h(x) = f(g(x)) => h'(x) = f'(g(x))g'(x)
  1362.  
  1363. 8.1.7.2 Common derivatives
  1364.  
  1365. Function   Derivative
  1366. --------------------------
  1367. x^n        nx^(n-1)
  1368. 1/x        -1/(x^2)
  1369. √x         1/(2√x)
  1370. sin x      cos x
  1371. cos x      - sin x
  1372. tan x      1/(cos(x)^2)
  1373. cot x      -1/(sin(x)^2)
  1374. e^x        e^x
  1375. a^x        a^x ln a, when a>0
  1376. log(a,x)   1/(x ln a), when a, x > 0, a ≠ 1
  1377. ln x       1/x, when x > 0
  1378. asin x     1/(√(1 - x^2))
  1379. atan x     1/(1 + x^2)
  1380.  
  1381. 8.1.8 Integrals
  1382.  
  1383. 8.1.8.1 Primitive functions
  1384.  
  1385. F(x) is a primitive function to f(x) on an interval if
  1386.     F'(x) = f(x) on the interval.
  1387.  
  1388. An indefinite integral can be written ∫f(x) dx = F(x) + C.
  1389.  
  1390. 8.1.8.2 Rules of Integration
  1391.  
  1392. a∫b f(x) dx = F(b) - F(a)
  1393. a∫b f(x) dx = a∫c f(x) dx + c∫b f(x) dx
  1394. a∫b [f(x) + g(x)] dx = a∫b f(x) dx + a∫b g(x) dx
  1395. a∫b k f(x) dx = k a∫b f(x) dx
  1396.  
  1397. 8.1.8.3 Common Integration Methods
  1398.  
  1399. Partial integration
  1400. -------------------
  1401. ∫f'g dx = fg - ∫fg' dx
  1402.  
  1403. Substitution
  1404. ------------
  1405. a∫b f(g(x))g'(x) dx = g(a)∫g(b) f(t) dt
  1406.  
  1407. 8.1.8.4 Some primitive functions
  1408.  
  1409. Function              Primitive function
  1410. -----------------------------------
  1411. k                     kx
  1412. x^n                   x^(n+1)/(n+1)
  1413. 1/x                   ln |x|
  1414. e^x                   e^x
  1415. a^x                   a^x/ln a
  1416. 1/(x - a)             ln (abs(x - a))
  1417. 1/(x - a)(x - b)      1/(a - b) ln((x - a)/(x - b))
  1418. 1/(x - a)^2           -1/(x - a)
  1419. 1/(x^2 + a^2)         1/a atan(x/a)
  1420. x/(x^2 + a^2)         1/2 ln (x^2 + a^2)
  1421. √(x^2 + a^2)          x/2 √(x^2 + a^2) + a^2/2 ln (x + √(x^2 + a^2))
  1422. √(x^2 - a^2)          x/2 √(x^2 - a^2) - a^2/2 ln (abs(x + √(x^2 - a^2)))
  1423. 1/√(x^2 + a^2)        ln(x + √(x^2 + a^2))
  1424. 1/√(x^2 - a^2)        ln(abs(x + √(x^2 - a^2)))
  1425. 1/√(a^2 - x^2)        asin(x/a)
  1426. sin x                 -cos x
  1427. (sin x)^2             1/2(x - sin x cos x)
  1428. 1/sin x               ln(abs(tan(x/2)))
  1429. 1/(sin x)^2           -cot x
  1430. cos x                 sin x
  1431. 1/cos x               ln(abs(tan(x/2 + π/4)))
  1432. 1/(cos x)^2           tan x
  1433. tan x                 - ln(abs(cos x))
  1434.  
  1435. 8.1.9 Conics
  1436.  
  1437. Circle with midpoint in (p, q) and radius r
  1438.    (x - p)^2 + (y - q)^2 = r^2
  1439.  
  1440. Parabola with vertex in origin and focus in (c,0)
  1441.    y^2 = 4cx
  1442.  
  1443. Ellipse with midpoint in origin and foci in (c,0) and (-c,0)
  1444.     x^2/a^2 + y^2/b^2 = 1, where a^2 - b^2 = c^2
  1445.  
  1446. Hyperbola with midpoint in origin and foci in (c,0) and (-c, 0)
  1447.     x^2/a^2 - y^2/b^2 = 1, where a^2 + b^2 = c^2
  1448.  
  1449. The asymptotes of the hyperbola are given by
  1450.     y = bx/a and y = -bx/a
  1451.  
  1452. 8.1.10 Differential equations
  1453. 
  1454. A differential equation is an equation involving derivatives. A differential equation of the form
  1455.  
  1456.     f(y, y', y'', …) = 0
  1457.  
  1458. is called a homogenous differential equation. The general solution of a differential equation of the form
  1459.  
  1460.    f(y, y', y'', …) = g(x)
  1461.  
  1462. is given by adding a function which solves the equation (a particular solution) to the general solution of the corresponding homogenous equation.
  1463.  
  1464. 8.1.10.1 First order
  1465.  
  1466. y' + ay = 0 has the solution:
  1467.    y(x) = Ce^(-ax)
  1468.    where C is an arbitrary constant
  1469.  
  1470. y' + ay = b has the solution:
  1471.    y(x) = b/a + Ce^(-ax)
  1472.  
  1473. y' + ay = f(x) has the solution:
  1474.    y(x) = e^(-ax)(C + ∫e^(ax)f(x) dx)
  1475.  
  1476. y' + y f(x) = g(x) has the solution:
  1477.    y(x) = (G(x) + C)e^(-F(x))
  1478.    where F(x) is a primitive function to f(x) and G(x) is a primitive function to g(x)e^F(x)
  1479.  
  1480. 8.1.10.2 Second order
  1481.  
  1482. y'' + ay' + by = 0
  1483.    has the characteristic equation
  1484. h^2 + ah + b = 0
  1485.    with the roots h1 and h2
  1486.  
  1487. • If h1 and h2 are real numbers, such that h1 ≠ h2, then the solution is given by:
  1488.    y(x) = C1e^(h1x) + C2e^(h2x)
  1489. • If h1 and h2 are real numbers, such that h1 = h2, then the solution is given by:
  1490.    y(x) = e^(h1x)(C1x + C2)
  1491. • If the function lacks real roots, the solution is given by:
  1492.    y(x) = e^(-1/2 ax)(C1 cos kx + C2 sin kx)
  1493.    where k = √(-a^2/4 + b)
  1494.  
  1495. 8.1.11 Geometry
  1496.  
  1497. 8.1.11.1 Parallelogram 
  1498.  
  1499. Sides a and b and height against a, h
  1500. Area = ah
  1501. Diagonals c and d, c^2 + d^2 = 2a^2 + 2b^2
  1502.  
  1503. 8.1.11.2 Parallel trapezium
  1504.  
  1505. Parallel sides: a and b
  1506. Height: h
  1507. Area = h(a + b)/2
  1508.  
  1509. 8.1.11.3 Circle
  1510.  
  1511. Radius: r
  1512. Diameter = 2r
  1513. Circumference = 2πr
  1514. Area = πr^2
  1515.  
  1516. 8.1.11.4 4 Circle sector
  1517.  
  1518. Radius: r
  1519. Central angle: a rad
  1520. Side = ar
  1521. Area = ar^2/2
  1522.  
  1523. 8.1.11.5 Prism
  1524.  
  1525. Area: B
  1526. Height: h
  1527. Volume = Bh
  1528.  
  1529. 8.1.11.6 Pyramid
  1530.  
  1531. Area: B
  1532. Height: h
  1533. Volume = Bh/3
  1534.  
  1535. 8.1.11.7 Straight circular cylinder
  1536.  
  1537. Radius: r
  1538. Bottom disc area: πr^2
  1539. Cylindrical wall area: 2πrh
  1540. Volume: πhr^2
  1541.  
  1542. 8.1.11.8 Straight circular cone
  1543.  
  1544. Radius: r
  1545. Height: h
  1546. Side = √(r^2 + h^2)
  1547. Surface area = πr√(r^2 + h^2)
  1548. Bottom disc area: πr^2
  1549. Volume = 1/3 πhr^2
  1550.  
  1551. 8.1.11.9 Sphere
  1552.  
  1553. Radius: r
  1554. Area = 4πr^2
  1555. Volume = 4πr^3/3
  1556.  
  1557. 8.1.12 Trigonometry
  1558.  
  1559. 8.1.12.1 Pythagoras' theorem
  1560.  
  1561. If the length  of the two perpendicular sides in a right angled are a and b and the length of the hypotenuse is c, the following relationship holds:
  1562.     a^2 + b^2 = c^2
  1563.  
  1564. 8.1.12.2 Definitions
  1565. 
  1566. Unit circle
  1567. -----------
  1568. Let c be a circle with centre in the origin and radius 1. Let r be a radius in the circle which makes angle ß with the positive x-axis (positive angles are measured counter-clockwise). Let (x,y) be the point of intersection between r and c, we then have
  1569.     sin ß = y
  1570.     cos ß = x
  1571.  
  1572. Triangle
  1573. --------
  1574. In a right angled triangle, the sine of an angle is the length of the opposite side divided by the hypotenuse. The cosine of the angle is length of the adjacent side divided by the hypotenuse.
  1575.  
  1576. Other trigonometric functions
  1577. -----------------------------
  1578. tan ß = sin ß / cos ß
  1579. cot ß = cos ß / sin ß
  1580. sec ß = 1 / cos ß
  1581. csc ß = 1 / sin ß
  1582.  
  1583. 8.1.12.3 The Triangle
  1584.  
  1585. Let a, b, c be the sides of a triangle and A, B, C be the angles facing the corresponding sides. Let T be the are of the triangle. We then have:
  1586.  
  1587. (The sine theorem)
  1588.     sin A/a = sin B/b = sin C/c
  1589.  
  1590. (The cosine theorem)
  1591.     a^2 = b^2 + c^2 - 2bc cos A
  1592.  
  1593. (The area theorem)
  1594.     T = ab/2 sin C
  1595.  
  1596. 8.1.12.4 Trigonometric Identities
  1597.  
  1598. (sin ß)^2 + (cos ß)^2 = 1
  1599.  
  1600. sin (ß + ∂) = sin ß cos ∂ + sin ∂ cos ß
  1601. sin (ß - ∂) = sin ß cos ∂ - sin ∂ cos ß
  1602. cos (ß + ∂) = cos ß cos ∂ - sin ß sin ∂
  1603. cos (ß - ∂) = cos ß cos ∂ + sin ß sin ∂
  1604.  
  1605. tan (ß + ∂) = (tan ß + tan ∂)/(1 - tan ß tan ∂)
  1606. tan (ß - ∂) = (tan ß - tan ∂)/(1 + tan ß tan ∂)
  1607.  
  1608. sin ß + sin ∂ = 2 sin((ß + ∂)/2) cos((ß - ∂)/2)
  1609. sin ß - sin ∂ = 2 cos((ß + ∂)/2) sin((ß - ∂)/2)
  1610. cos ß + cos ∂ = 2 cos((ß + ∂)/2) cos((ß - ∂)/2)
  1611. cos ß - cos ∂ = -2 sin((ß + ∂)/2) sin((ß - ∂)/2)
  1612.  
  1613. sin 2ß = 2 sin ß cos ß
  1614. cos 2ß = (cos ß)^2 - (sin ß)^2
  1615.        = 2 (cos ß)^2 - 1
  1616.        = 1 - 2 (sin ß)^2
  1617. tan 2ß = 2 tan ß/(1 - (tan ß)^2)
  1618.  
  1619. sin 3ß = 3 sin ß - 4(sin ß)^3
  1620. cos 3ß = 4(cos ß)^3 - 3 cos ß
  1621.  
  1622. (sin (ß/2))^2 = (1 - cos ß)/2
  1623. (cos (ß/2))^2 = (1 + cos ß)/2
  1624.  
  1625. 8.1.13 Sequences and series
  1626.  
  1627. 8.1.13.1 Arithmetic sequence
  1628.  
  1629. In an arithmetic sequence the difference between a number and the next a constant, if the first number is a and the difference d, the sequence looks like:
  1630.  
  1631.    a, a + d, a + 2d, a + 3d, a + 4d, a + 5d…
  1632.  
  1633. The sum of an arithmetic series is given by:
  1634.  
  1635.    s = t1 + t2 + … + tn = n (t1 + tn)/2
  1636.  
  1637. 8.1.13.2 Geometric sequence
  1638.  
  1639. In a geometric sequence the quotient between a number and the next is a constant. If the first number is a and the quotient k the sequence looks like:
  1640.  
  1641.    a, ak, ak^2, ak^3, ak^4, ak^5…
  1642.  
  1643. The sum of a geometric sequence is given by:
  1644.  
  1645.    s = a + ak + ak^2 + … + ak^(n-1) = a(k^n - 1)/(k - 1)
  1646. (Provided that k ≠1)
  1647.  
  1648. 8.1.13.3 Convergence
  1649.  
  1650. A series is said to be convergent if the sums of the n first terms has a limit as n approaches infinity.
  1651.  
  1652. A geometric series is convergent if -1 < k < 1 and does in that case have the sum s = a/(1 - k).
  1653.  
  1654. 8.1.14 Statistics
  1655.  
  1656. 8.1.14.1 Concepts
  1657.  
  1658. • A statistic material is a number of observations, in this document denoted by x1, x2, x3, x4, … xn.
  1659. • The frequency is the number of times a specific observation has occurred in the material.
  1660. • The relative frequency is the quotient of the frequency and the number of observations (n).
  1661. • If the material consists of real numbers it is divided in intervals.
  1662. • The accumulated frequency is the number of observations less than or equal to  a certain value.
  1663. • The accumulated relative frequency is the quotient of the accumulated frequency and the number of observations
  1664.  
  1665. 8.1.14.2 Mean, median, mode
  1666.  
  1667. The mean value is given by
  1668. _
  1669. x = (x1 + x2 + x3 + … + xn)/n = 1/n ∑ xi
  1670.  
  1671. The median is the value above and below which there are an equal number of values. If the number of observations is even, the median is the mean of the two mid-values.
  1672.  
  1673. The mode is the value that has the highest frequency of the observed values.
  1674.  
  1675. 8.1.14.3 Standard deviation
  1676.  
  1677. The standard deviation is given by:
  1678.  
  1679. s^2 = 1/(n-1) ∑ (xi - m)^2 
  1680.     = 1/n-1 (∑ (xi^2) - (∑ xi)^2/n)
  1681.  
  1682. where m is the mean value.
  1683.  
  1684. 8.1.15 Probability
  1685.  
  1686. 8.1.15.1 Basic Concepts
  1687.  
  1688. If p independent operations can be executed in n1, n2, n3, n4, … np different ways, the total number of possibilities is:
  1689.    N = n1 * n2 * n3 * … * np
  1690.  
  1691. The number of permutations of n element is given by:
  1692.    n! = 1 * 2 * 3 * … * n
  1693. By definition, 0! = 1.
  1694.  
  1695. Among n elements, k can be selected in:
  1696.    com(n, k) = n!/(k!(n-k)!) different ways.
  1697.  
  1698. 8.1.15.2 Binomial distribution
  1699.  
  1700. If the chance of success of an experiment is p, the chance that exactly k experiments of n should be successful is:
  1701.  
  1702.     com(n,k) p^k (1-p)^(n-k)
  1703.  
  1704. This is called binomial distribution. For this distribution the expected value u and the standard deviation o are given by:
  1705.    u = np
  1706.    o^2 = npq
  1707.  
  1708. 8.1.15.3 The common frequency function
  1709.  
  1710. The frequency function for the normal distribution with expected value u and standard deviation o is given by:
  1711.  
  1712.    f(x) = 1/(o√(2π)) e^(-1/2 ((x - u)/o)^2)
  1713.  
  1714. With u = 0 and o = 1, we get the standardized common frequency function
  1715.    f(x) := (1/√2π) e^(-x^2/2);
  1716.  
  1717. 8.1.15.4 Interval of confidence
  1718.  
  1719. From a normal distributed population with the mean value u and the standard deviation o an arbitrary sample of n elements and mean value x is taken. The following condition then holds with 95 % probability
  1720.  
  1721.    x - 1.96 o/√n ≤ u ≤ x + 1.96 o/√n
  1722.  
  1723. If 1.96 is changed to 2.58 the condition holds with 99 % probability.
  1724.  
  1725. 8.2. Physics
  1726.  
  1727. 8.2.1 Physical constants
  1728.  
  1729. Gravitational acceleration....... 9.8 m/s^2
  1730. Gas constant..................... 8.314 J/(mol K)
  1731. Atomic mass unit (u)............. 1.661E-27 kg = (931.5 MeV)
  1732. Neutron rest mass................ 1.0087 u
  1733. Proton rest mass................. 1.0073 u
  1734. Electron rest mass............... 0.0005486 u
  1735. Electron charge.................. 1.602E-19 As
  1736. Avogadro's number................ 6.022E23
  1737. 1 electron volt.................. 1.602E-19 J
  1738. Permittivity of free space....... 8.854E-12 F/m
  1739. Permeability of free space........ 4π*1E-7 H/m
  1740. Speed of light in vacuum......... 2.997972E8 m/s
  1741. Gravitational constant........... 6.672E-11 Nm^2/kg^2
  1742. Planck's constant................ 6.626E-34 Js
  1743. Boltzmann's constant............. 1.381E-23 JK
  1744. Rydberg's constant............... 1.097E7 m^-1
  1745. Absolute zero.................... -273.15 °C.
  1746.  
  1747. 8.2.2 Mechanics
  1748.  
  1749. The following symbols will be used in this section:
  1750.  
  1751.    m  = mass
  1752.    A  = area
  1753.    V  = volume
  1754.    s  = distance
  1755.    v  = velocity
  1756.    v0 = initial velocity
  1757.    t  = time
  1758.    a  = acceleration
  1759.    g  = acceleration in free fall
  1760.    F  = force
  1761.    M  = moment
  1762.    I  = impulse
  1763.    W  = work
  1764.    P  = power
  1765.  
  1766. 8.2.2.1 Density
  1767.  
  1768. The density r is given by:
  1769.  
  1770.    r = m/V
  1771.  
  1772. 8.2.2.2 Pressure
  1773.  
  1774. The pressure p by a force F on a surface of area A is given by
  1775.  
  1776.    p = F/A
  1777.  
  1778. The pressure p on the depth h in a fluid with density r is given by:
  1779.  
  1780.    p = hgr
  1781.  
  1782. 8.2.2.3 Velocity, acceleration
  1783.  
  1784. The average velocity, and the average acceleration:
  1785.  
  1786.    v = s/t
  1787.    a = v/t
  1788.  
  1789. The instantaneous velocity and acceleration:
  1790.  
  1791.   v = ds/dt
  1792.   a = dv/dt
  1793.  
  1794. 8.2.2.4 Movement with constant acceleration
  1795.  
  1796.    v = v0 + at
  1797.    s = v0t + at^2/2
  1798.    v^2 - v0^2 = 2as
  1799.  
  1800. 8.2.2.5 Newton's second law of motion
  1801.  
  1802.    F = ma
  1803.  
  1804. 8.2.2.6 Moment
  1805.  
  1806.    M = Fr
  1807.  
  1808. r is the perpendicular distance from the axis of revolution to the directional line of the force.
  1809.  
  1810. At equilibrium we have:
  1811.  
  1812.   ∑ M = 0
  1813.  
  1814. 8.2.2.7 Newton's law of gravitation
  1815.  
  1816.    F = GmM/r^2
  1817.  
  1818. m and M are the masses of the two bodies. r is the distance between them. G is the gravitational constant.
  1819.  
  1820.    G = 6.672E-11 Nm^2/kg^2
  1821.  
  1822. 8.2.2.8 Friction
  1823.  
  1824.    F = uN
  1825.  
  1826.  u = frictional coefficient
  1827.  N = normal force
  1828.  
  1829. 8.2.2.9 Throwing parabola
  1830.  
  1831.  ß = angle of elevation
  1832.  vx = speed in x-direction
  1833.  vy = speed in y-direction
  1834.  
  1835.    vx = v0 cos ß
  1836.    vy = v0 sin ß - gt
  1837.  
  1838.    x = v0t cos ß
  1839.    y = v0t sin ß - gt^2/2
  1840.  
  1841. 8.2.2.10 Momentum
  1842.  
  1843. Momentum = mv
  1844. Change in momentum = impulse
  1845. I = Ft = mv - mv0
  1846.  
  1847. 8.2.2.11 Centripetal force
  1848.  
  1849.  r = radius
  1850.  T = period
  1851.  
  1852.    F = mv^2/r = 4π^2mr/T^2
  1853.  
  1854. 8.2.2.12 Harmonic motion
  1855.  
  1856. Harmonic motion is represented by the differential equation:
  1857.  
  1858.    m d^2s/dt^2 = -ks
  1859.  
  1860. which is solved by:
  1861.  
  1862.    s = A sin (wt + ß)
  1863.  
  1864. A and ß are constants. w is the angular speed, A is the amplitude and ß is the phase angle.
  1865.  
  1866.    w = √(k/m)
  1867.  
  1868.    T = 2π√(m/k) (where T is the period)
  1869.  
  1870. For small oscillations in a pendulum, the following holds:
  1871.  
  1872.    T = 2π√(l/g)
  1873.  
  1874. 8.2.2.13 Work, energy
  1875.  
  1876.    W = Fs   or   W = ∫F ds
  1877.  
  1878. (F is the force in the direction of the movement.)
  1879.  
  1880. Potential energy for a body with mass m on the height h above ground level:
  1881.  
  1882.    W = mgh
  1883.  
  1884. Kinetic energy for a body of mass m moving at speed v:
  1885.  
  1886.    W = mv^2/2
  1887.  
  1888. 8.2.2.14 Power
  1889.  
  1890.    P = W/t
  1891.  
  1892. (W is the change in energy during the time t.)
  1893.  
  1894. 8.2.2.15 Straight central collision
  1895.  
  1896.    mv + m'v' = mv0 + m'v0'
  1897.  
  1898. (Preservation of momentum)
  1899. v0 and v0' are the speeds before the collision
  1900. v and v' are the speeds after the collision
  1901.  
  1902.    e = (v' - v)/(v0 - v0')
  1903.  
  1904. (e is the bouncing coefficient)
  1905.  
  1906. With e = 1 we get a completely elastic collision:
  1907.  
  1908.    v' - v = v0 - v0'
  1909.  
  1910. With e = 0 we get a completely inelastic collision:
  1911.  
  1912.    v = (mv0 + m'v0')/(m + m')
  1913.  
  1914. 8.2.2.16 Hookes' law
  1915.  
  1916.    F = ks
  1917.  
  1918. The elongation of a spring is proportional to the pulling force.
  1919.  
  1920. 8.2.3 Proprieties of gases
  1921.  
  1922. The following symbols will be used in this section:
  1923.  
  1924.    T = temperature (in °K)
  1925.    p = pressure
  1926.    V = volume
  1927.  
  1928. 8.2.3.1 Boyle's law
  1929.  
  1930.    pV = constant
  1931.  
  1932. (when the temperature is constant)
  1933.  
  1934. 8.2.3.2 Charles' law
  1935.    
  1936.    p = constant * T
  1937.  
  1938. (at constant volume)
  1939.  
  1940. 8.2.3.3 Gay-Lussac's law
  1941.  
  1942.    V = constant * T
  1943.  
  1944. (at constant pressure)
  1945.  
  1946. 8.2.3.4 General gas law
  1947.  
  1948.    pV = nRT
  1949.  
  1950. (n = number of mols, 
  1951.  R = gas constant = 8.314 J/(mol K))
  1952.  
  1953.    r = p/p0 T0/T r0
  1954.  
  1955. (p0 = initial pressure - 101.3 kPa
  1956.  T0 = initial temperature - 273 °K
  1957.  r0 = initial density - density at 101.3 kPa, 273 °K)
  1958.  
  1959. 8.2.3.5 Volume expansion of a gas at constant pressure
  1960.  
  1961.    (V - V0)/(V0 (T - T0)) = 1/273 K^-1
  1962.  
  1963. (T - T0 = change in temperature)
  1964.  
  1965. 8.2.3.6 Dalton's law
  1966.  
  1967.    p = p1 + p2 + …
  1968.  
  1969. (p1, p2, … = partial pressures)
  1970.  
  1971. 8.2.3.7 Kinetic gas theory
  1972.  
  1973.  m   = the mass of one molecule of gas
  1974.  N   = the number of molecules
  1975.  [v^2] = the average of the square of the velocities
  1976.  [W] = the average of kinetic energy per molecule
  1977.  r   = density
  1978.  
  1979.    p = 1/3 Nm[v^2]/V
  1980.  
  1981.    pV = 1/3 Nm[v^2] = 2/3 N[W]
  1982.  
  1983.    [v^2] = 3 p/r
  1984.  
  1985.    [W] = 1/2 m[v^2] = 3/2 kT
  1986.  
  1987. (k is Boltzmann's constant = 1.381E-23 J/K
  1988.  k = R/A, where R is the gas constant and A is Avogadro's constant)
  1989.  
  1990. 8.2.4 Theory of heat
  1991.  
  1992. The heat capacity of a body = cm, where c is the specific heat capacity.
  1993.  
  1994. The change in heat energy of a body:
  1995.    dQ = cm dT
  1996.  
  1997. 8.2.5 Electronics I - Electrostatics, direct current
  1998.  
  1999. Symbols used in this section:
  2000.  
  2001.    F  force
  2002.    Q  electric charge
  2003.    I  electric current
  2004.    t  time
  2005.    U  voltage
  2006.    W  work, energy
  2007.    K  electric field
  2008.    C  capacitance
  2009.    R  resistance
  2010.    r  resistivity
  2011.    E  electromotive force, emf
  2012.    P  power
  2013.  
  2014. 8.2.5.1 Coulomb's law
  2015.  
  2016.    F = kqQ/r^2
  2017.  
  2018. The force between two charges q and Q at distance r. In vacuum the constant k is ≈ 8,99E9 Nm^2/(As)^2
  2019.  
  2020. 8.2.5.2 Charge
  2021.  
  2022.    Q = It
  2023.  
  2024. The charge delivered by a current I during the time t.
  2025.  
  2026. 8.2.5.3 Voltage
  2027.  
  2028.    U = W/Q
  2029.  
  2030. The voltage between two points equals the work required to transport a charge from one point to the other, divided by the charge's charge.
  2031.  
  2032.    U = V1 - V2
  2033.  
  2034. The voltage between two points equals the difference in electric potential.
  2035.  
  2036. 8.2.5.4 Electric Field Force
  2037.  
  2038.    K = F/Q
  2039.  
  2040. The field force equals the force on a charge divided by the charge's charge.
  2041.  
  2042. The field force in a homogenous field between two charged parallel planes:
  2043.  
  2044.    K = U/d
  2045.  
  2046. (U = voltage between the planes
  2047.  d = distance between the planes)
  2048.  
  2049. 8.2.5.5 Capacitance
  2050.  
  2051.    C = Q/U
  2052.  
  2053. In the flat capacitor we have:
  2054.  
  2055.    C = e A/d
  2056.  
  2057. (A = the area of one plane
  2058.  d = the distance between the planes
  2059.  e = the permittivity of the material)
  2060.  
  2061.    1/C = 1/C1 + 1/C2 + …
  2062.  
  2063. (Connecting capacitors in series.)
  2064.  
  2065.    C = C1 + C2 + …
  2066.  
  2067. (Connecting capacitors in parallel.)
  2068.  
  2069. The energy of an electrostatic field:
  2070.  
  2071.    W = 1/2 CU^2 = 1/2 QU = 1/2 Q^2/C
  2072.  
  2073. 8.2.5.6 Resistance
  2074.  
  2075.    R = U/I
  2076.  
  2077. (Ohm's law)
  2078.  
  2079.    R = r l/A
  2080.  
  2081. (The resistance in a wire of length l, cross-sectional area A and resistivity r.)
  2082.  
  2083.    R = R1 + R2 + …
  2084.  
  2085. (Connecting resistors in series.)
  2086.  
  2087.    1/R = 1/R1 + 1/R2 + …
  2088.  
  2089. (Connecting resistors in parallel.)
  2090.  
  2091.    R = R0(1 + aT)
  2092.  
  2093. (The resistance of a material having resistance R0 at 0 °C at the temperature T °C.
  2094.  a = temperature coefficient.)
  2095.  
  2096. 8.2.5.7 Electrolytic battery
  2097.  
  2098.    m = 1/F M/n It
  2099.  
  2100. (m = mass
  2101.  M = molar mass
  2102.  n = ion charge
  2103.  t = time
  2104.  F = Faraday's constant = 96487 As/mol)
  2105.  
  2106. 8.2.5.8 Power and energy
  2107.  
  2108. The power in a wire subject to Ohm's law:
  2109.  
  2110.    P = UI = RI^2 = U^2/R
  2111.  
  2112. The energy developed in the wire during the time t:
  2113.  
  2114.    W = Pt
  2115.  
  2116. 8.2.6 Electronics II Magnetism
  2117.  
  2118. The following symbols are used in this section.
  2119.  
  2120.    B   magnetic flux density
  2121.    v   velocity
  2122.    ƒ   magnetic flux
  2123.    N   number of wire loops
  2124.    L   inductance
  2125.  
  2126. 8.2.6.1 Magnetic flux density
  2127.  
  2128.    B = constant * f^2
  2129.  
  2130.    f is the frequency of a magnetic material in harmonic motion about an equilibrium
  2131.  
  2132. 8.2.6.2 Laplace's formula
  2133.  
  2134. A conducting element of length Δl gives an addition ΔB to the flux density B in a point P on the distance r. In vacuum:
  2135.  
  2136.    ΔB = uI sin(a) Δl/(4πr^2)
  2137.  
  2138.    a is the angle between the element and a line from the element to P.
  2139.    u = 4π * 10^-7 is the permeability of vacuum.
  2140.    I is the current through the conductor.
  2141.  
  2142. The magnetic flux density on distance d of a straight conductor of infinite length in vacuum:
  2143.  
  2144.    B = 2uI/(4πd)
  2145.  
  2146. The magnetic flux density at the midpoint of a flat circular coil of radius r:
  2147.  
  2148.    B = uNI/(2r)
  2149.  
  2150. The magnetic flux density in a toroid or solenoid
  2151.  
  2152.    B = uNI/l
  2153.  
  2154.    u is the permeability of the material inside the solenoid.
  2155.    l is the length of the solenoid.
  2156.  
  2157. The permeability of air roughly equals the permeability of vacuum.
  2158.  
  2159. 8.2.6.3 Magnetic flux
  2160.  
  2161. With a constant flux density B perpendicular to an area A, the magnetic flux through the area is given by:
  2162.  
  2163.    ƒ = BA
  2164.  
  2165. 8.2.6.4 Force between magnetic fields and charges in motion
  2166.  
  2167.    F = IlB
  2168.  
  2169.    l is the length of the conductor in a field perpendicular to the conductor.
  2170.  
  2171.    F = QvB
  2172.  
  2173.    When the charged particle is moving perpendicularly to the field direction.
  2174.  
  2175. 8.2.6.5 Electromagnetic induction
  2176.  
  2177. For the induced current e in a closed circuit where N is the number of loops and ƒ is the magnetic flux through the circuit:
  2178.  
  2179.    e = -N dƒ/dt
  2180.  
  2181. For a conductor of length l moved perpendicularly to a magnetic field of magnetic flux density B, where v is the velocity of the conductor:
  2182.  
  2183.    e = lvB
  2184.  
  2185. For self-induction in a solenoid:
  2186.  
  2187.    e = -L di/dt
  2188.  
  2189.    L is the inductance of the solenoid.
  2190.  
  2191. The energy of a magnetic field inside a solenoid:
  2192.  
  2193.    W = 1/2 Li^2
  2194.  
  2195. 8.2.7 Electronics III. Alternating current.
  2196.  
  2197. (All formulas in this section refer to a sine-shaped current.)
  2198.  
  2199. The following symbols will be used in this section:
  2200.  
  2201.    i, u   momentary current and voltage
  2202.    î, û   amplitudes for current and voltage
  2203.    I, U   effective values for current and voltage
  2204.    w      angular frequency
  2205.    f      frequency
  2206.    t      time
  2207.    P      average power
  2208.    Z      impedance
  2209.  
  2210. 8.2.7.1 Basics
  2211.  
  2212. Momentary values for current and voltage are found by:
  2213.  
  2214.    u = û sin (wt + a)
  2215.    i = î sin (wt + b)
  2216.  
  2217.    a and b are phase angles
  2218.  
  2219.    w = 2πf
  2220.    f = 1/T
  2221.  
  2222.    T is the period
  2223.  
  2224.    i = dQ/dt
  2225.  
  2226. For the phase lag of the current and the voltage:
  2227.  
  2228.    ƒ = a - b
  2229.  
  2230.    U = û/√2
  2231.    I = î/√2
  2232.  
  2233. With solely resistive load:
  2234.  
  2235.    i = î sin wt
  2236.    u = û sin wt
  2237.  
  2238.    î = û/R
  2239.  
  2240. With solely inductive load:
  2241.  
  2242.    i = î sin wt
  2243.    u = û sin (wt + π/2)
  2244.    
  2245.    û = wLî
  2246.  
  2247.    wL is the inductive reactance
  2248.  
  2249. With solely capacitive load:
  2250.  
  2251.    i = î sin wt
  2252.    u = û sin (wt - π/2)
  2253.  
  2254.    û = î/(WC)
  2255.  
  2256.    1/(WC) is the capacitive reactance
  2257.  
  2258. 8.2.7.2 Impedance and phase lag
  2259.  
  2260. Impedance of a load:
  2261.  
  2262.    Z = û/î = U/I
  2263.  
  2264. LRC - circuit in series:
  2265.  
  2266.    Z = √(R^2 + (wL - 1/(wC)^2)
  2267.  
  2268.    tan ƒ = (wL - 1/(wC))/R
  2269.  
  2270. LRC - circuit in parallel
  2271.  
  2272.    Z = 1/(√(1/R^2 + (1/(wL) - wC)^2))
  2273.  
  2274.    tan ƒ = R(1/(wL) - wC)
  2275.  
  2276. 8.2.7.3 Resonance
  2277.  
  2278. Resonance in a connection in series of an R, an L and a C component appears when:
  2279.  
  2280.    w = 1/√(LC)
  2281.  
  2282. Then the impedance is given by R.
  2283.  
  2284. 8.2.7.4 Power
  2285.  
  2286. The average power P in a load is given by:
  2287.  
  2288.    P = UI cos ƒ
  2289.  
  2290. 8.2.7.5 Transformer
  2291.  
  2292. For an ideal transformer we have:
  2293.  
  2294.    u/U = n/N
  2295.    ni = NI
  2296.  
  2297.    n, N   number of loops in primary and secondary coil respectively
  2298.    u, U   effective voltage values across primary and secondary coil
  2299.    i, I   effective current through primary and secondary coil
  2300.  
  2301. 8.2.7.6 Electronic oscillator
  2302.  
  2303. In an electronic oscillator with inductance L, capacitance C and resistance 0, we have:
  2304.  
  2305.    L d^2i/dt^2 + i/C = 0
  2306.  
  2307. This differential equation is satisfied by:
  2308.  
  2309.    i = î sin wt, where w = 1/√(LC)
  2310.  
  2311.    T = 2π√(LC)
  2312.  
  2313. 8.2.8 Optics
  2314.  
  2315. The following symbols are used in this section:
  2316.  
  2317.    ƒ   light flux
  2318.    I   light strength 
  2319.    E   illumination
  2320.    A   area
  2321.    l   distance from light source to illuminated area
  2322.    â   angle between light and surface normal
  2323.    a   distance from object to mirror or lens
  2324.    b   distance from picture to mirror or lens
  2325.    r   radius of curved surface
  2326.    f   focal length
  2327.    n   index of refraction
  2328.    ß   angle of refraction
  2329.    ∂   angle of deviation
  2330.    c   light speed in vacuum
  2331.    v   light speed in a medium
  2332.  
  2333. 8.2.8.1 Photometrics
  2334.  
  2335.    ƒ = 4πI
  2336.  
  2337.    E = ƒ/A
  2338.  
  2339.    E = I cos â /l^2
  2340.  
  2341. 8.2.8.2 Spherical mirrors
  2342.  
  2343.    1/a + 1/b + 1/f = 2/r
  2344.  
  2345.    dD = f^2
  2346.  
  2347.    d = distance from object to focus
  2348.    D = distance from picture to focus
  2349.  
  2350. 8.2.8.3 Law of refraction
  2351.  
  2352.    n sin â = m sin û
  2353.  
  2354.    m, û = index of refraction and angle of refraction in the second medium
  2355.  
  2356. 8.2.8.4 Index of refraction
  2357.  
  2358.    n = c/v
  2359.  
  2360. 8.2.8.5 Minimum deviation in prism
  2361.  
  2362. n sin ((ß + ∂)/2) = m sin (ß/2)
  2363.  
  2364.    ß = top angle of prism
  2365.    ∂ = angle of deviation
  2366.    n = index of refraction outside prism
  2367.    m = index of refraction inside prism
  2368.  
  2369. 8.2.8.6 Thin lenses
  2370.  
  2371.    1/a + 1/b = 1/f
  2372.  
  2373.    dD = f^2
  2374.  
  2375.    d = distance from object to object focus
  2376.    D = distance from image to image focus
  2377.  
  2378. 8.2.9 Wave theory
  2379.  
  2380. The following symbols are used in this section:
  2381.  
  2382.    v   speed of propagation
  2383.    f   frequency
  2384.    l   wave length
  2385.    T   period
  2386.    t   time
  2387.  
  2388. 8.2.9.1 Basics
  2389.  
  2390.    v = lf
  2391.  
  2392.    f = 1/T
  2393.  
  2394. 8.2.9.2 Doppler effect
  2395.  
  2396.    f = emitted frequency
  2397.    g = observe frequency
  2398.    c = speed of propagation
  2399.  
  2400. Source at rest, observer approaching with velocity v:
  2401.  
  2402.    g = f(1 + v/c)
  2403.  
  2404. Source at rest, observer withdrawing with velocity v:
  2405.  
  2406.    g = f(1 - v/c)
  2407.  
  2408. Observer at rest, source approaching with speed v:
  2409.  
  2410.    g = f/(1 - v/c)
  2411.  
  2412. Observer at rest, source withdrawing with velocity v:
  2413.  
  2414.    g = f/(1 + v/c)
  2415.  
  2416. 8.2.9.3 Speed of sound
  2417.  
  2418. v = u√(T/273)
  2419.  
  2420.    T = temperature
  2421.    u = speed at T = 273
  2422.  
  2423. 8.2.10 Electromagnetic radiation
  2424.  
  2425. The following symbols are used in this section:
  2426.  
  2427.    M   emissivity
  2428.    T   absolute temperature
  2429.    l   wavelength
  2430.  
  2431. 8.2.10.1 Stefan-Boltzmann's law
  2432.  
  2433.    M = sT^4
  2434.  
  2435.    where s = 56.70 nW/(m^2K^4)
  2436.  
  2437. 8.2.10.2 Wien's displacement law
  2438.  
  2439.    lT = 2898 umK
  2440.  
  2441.    l = wavelength with maximum energy
  2442.  
  2443. 8.2.10.3 Diffraction grating
  2444.  
  2445.    ml = d sin a
  2446.  
  2447.    m = order of interference fringe
  2448.    d = distance between two lines in diffraction grating
  2449.    a = angle of deviation
  2450.  
  2451. 8.2.11 Nuclear physics
  2452.  
  2453. The following symbols are used in this section:
  2454.  
  2455.    h   Planck's constant = 6.626 * 10^-34 Js
  2456.    W   energy
  2457.    f   frequency
  2458.    l   wavelength
  2459.    m   mass
  2460.    v   velocity
  2461.    c   light speed in vacuum
  2462.    U   voltage
  2463.    e   charge of electron
  2464.  
  2465. 8.2.11.1 Planck's law
  2466.  
  2467.    W = hf
  2468.  
  2469. 8.2.11.2 Photoelectric effect
  2470.  
  2471.    hf = W + mv^2/2
  2472.    hf = W + eU
  2473.  
  2474.    W = work of emission
  2475.  
  2476. 8.2.11.3 de Broglie's formula
  2477.  
  2478.    l = h/(mv)
  2479.  
  2480. 8.2.11.4 Radioactive decay
  2481.  
  2482.    N = Me^(-kt)
  2483.  
  2484.    M = original mass
  2485.    N = mass at time t
  2486.    k = a constant
  2487.    e = base of system of natural logarithms, 2.718…
  2488.  
  2489. 8.2.11.5 Theory of relativity
  2490.  
  2491.    W = mc^2
  2492.  
  2493.    m = M/√(1 - v^2/c^2)
  2494.    l = L√(1 - v^2/c^2)
  2495.  
  2496.    M = mass at rest
  2497.    L = length at rest
  2498.  
  2499. 8.3. Chemistry
  2500.  
  2501. 8.3.1 Chemical equilibrium
  2502.  
  2503. For the chemical equilibrium aA + bB <-> cC + dD, we have
  2504.  
  2505.    [C]^c*[D]^d/([A]^a*[B]^b) = C
  2506.  
  2507. Where C is a constant.
  2508.  
  2509. 8.3.2 Acids and bases
  2510.  
  2511. Acid constant for the acid HA:
  2512.  
  2513.    K = [H30+] * [A-] / [HA]
  2514.  
  2515. Base constant for the base A-:
  2516.  
  2517.    K = [HA] * [OH-] / [A-]
  2518.  
  2519.    pH = -lg[H30+]
  2520.    pOH = -lg[OH-]
  2521.  
  2522.    [H30+] * [OH-] = K ≈ 1E-14 (mol/dm^3)^2
  2523.    pH + pOH = pK ≈ 14
  2524.  
  2525.    K(a) + K(b) = K = 1E-14
  2526.  
  2527.    K(a) = acid constant
  2528.    K(b) = base constant
  2529.  
  2530. 8.4. Economics
  2531. 
  2532. 8.4.1 Interest
  2533.  
  2534. The value of the deposit d with p % interest after t years:
  2535.    d(1 + p/100)^t
  2536.  
  2537. The value of an annual deposit d with p % interest after t years.
  2538.    d((1 + p/100)^t -1)/(p/100)
  2539.  
  2540. A loan l to an interest of p % is paid back with equal amounts in t years. The necessary amount is given by:
  2541.    l((1 + p/100)^t*p/100)/((1 + p/100)^t -1)
  2542.  
  2543. A deposit to an interest of p % will have the value v in t years, the current value is given by:
  2544.    v/(1 + p/100)^t
  2545. 9. Error Codes
  2546.  
  2547. 9.1. Acsc value not defined
  2548.  
  2549.     This error will appear when you try to calculate the arccosecant of a value for which the function is not defined.
  2550.  
  2551. 9.2. Arccosine argument not between -1 and 1
  2552.  
  2553.     This error will appear if you try to calculate acos() of a value that is not between -1 and 1, since acos is only defined for values in the interval [-1, 1]. acos(2).
  2554.  
  2555. 9.3. Arcsine argument not between -1 and 1
  2556.  
  2557.     This error will appear if you try to calculate asin() of a value that is not between -1 and 1, since asin is only defined for values in the interval [-1, 1]. asin(2).
  2558.  
  2559. 9.4. Asec value not defined
  2560.  
  2561.     This error will appear when you try to calculate the arcsecant of a value for which the function is not defined.
  2562.  
  2563. 9.5. Cot value not defined
  2564.  
  2565.     This error will appear when you try to calculate the cotangent of a value for which the function is not defined.
  2566.  
  2567. 9.6. Csc value not defined
  2568.  
  2569.     This error will appear when you try to calculate the cosecant of a value for which the function is not defined.
  2570.  
  2571. 9.7. Division by complex zero
  2572.  
  2573.     This error will appear if you try to make a complex division with a complex zero. (2, 3) /' (0, 0).
  2574.  
  2575. 9.8. Division by zero
  2576.  
  2577.     This error will appear if you try to divide a number by zero. 5 / 0.
  2578.  
  2579. 9.9. Else without if
  2580.  
  2581.     This error will appear if the computer finds an else statement without a preceding if statement, since such expressions are meaningless. 
  2582.  
  2583. 9.10. End without while or if
  2584.  
  2585.     This error will appear if you have used and end statement without a preceding if or while statement, since such expressions are meaningless.
  2586.  
  2587. 9.11. Expression too complex
  2588.  
  2589.     This error will appear in the rare occasion that your expression has become too complex for the computer to understand. Try splitting up a long statement to several smaller statements.
  2590.  
  2591. 9.12. Function lacking arguments
  2592.  
  2593.     This error will appear if you have passed to few arguments to a function for example calling: angle(3); would raise this error, since angle() requires two arguments.
  2594.  
  2595. 9.13. Function name too long
  2596.  
  2597.     This error will appear if you have used a function name which is longer than 30 characters. None of the functions that the calculator recognizes are so long, so this should generally be a typing error.
  2598.  
  2599. 9.14. Function nesting too complex
  2600.  
  2601.     This error will appear if there are too many while statements inside each other. Try breaking up the structure to prevent too deep nesting.
  2602.  
  2603. 9.15. Interrupted by user
  2604.  
  2605.     This error will appear if you interrupt program execution or graph-drawing by pressing the command key together with the period. This is useful if you have written a while statement that fails to terminate.
  2606.  
  2607. 9.16. Invalid arithmetic sum
  2608.  
  2609.     This error will appear if the three arguments sent to the arit() function can't possibly be the first second and last terms of an arithmetic sum. arit(1,0,3) will raise this error.
  2610.  
  2611. 9.17. Invalid geometric sum
  2612.  
  2613.     This error will appear if the three arguments passed to the geom() function can't possibly be the first second and last terms of a geometric sum. geom (1,1,4) will raise this error.
  2614.  
  2615. 9.18. Modulo zero
  2616.  
  2617.     This error will appear if you try to take modulo zero. Writing 4 % 0 will raise this error.
  2618.  
  2619. 9.19. Number or text used where variable is required
  2620.  
  2621.     This error will appear if you have used a number or text where the computer expected a variable. Writing 3 := 5 will raise this error.
  2622.  
  2623. 9.20. Passing non-text arguments to a function which requires text arguments
  2624.  
  2625.     This error will appear when you try to pass a number or a variable to a function that requires text arguments. message(2+3), will raise this error.
  2626.  
  2627. 9.21. Program too long
  2628.  
  2629.     This message means that your program has exceeded the 1000 memory cells that are reserved for program. If this happens there is not much to do, but to realise that your program has become too complex for this humble calculator. If you need to write the program, consider getting a "real" programming language.
  2630.  
  2631. 9.22. Raising negative number to fraction exponents
  2632.  
  2633.     This error will appear if you try to raise a negative number to a fraction exponent, since this is equivalent to trying to take a root of a negative value. (-2) ^ 0.5.
  2634.  
  2635. 9.23. Raising zero to negative exponent
  2636.  
  2637.     This error will appear if you try to raise zero to a negative exponent, since this is equivalent to dividing by zero. 0 ^ -2.
  2638.  
  2639. 9.24. Sec value not defined
  2640.  
  2641.     This error will appear when you try to calculate the secant of a value for which the function is not defined.
  2642.  
  2643. 9.25. Trying to calculate logarithm of negative value or zero
  2644.  
  2645.     This error will appear if you try to calculate the logarithm of a negative value or zero, since logarithms are not defined for these values. log(-1).
  2646.  
  2647. 9.26. Trying to invert zero
  2648.  
  2649.     This error will appear if you try to invert zero. inv(0).
  2650.  
  2651. 9.27. Trying to permute negative value
  2652.  
  2653.     This error will appear if you try to permute a negative value. (-1)!
  2654.  
  2655. 9.28. Trying to read beyond memory
  2656.  
  2657.     This error will appear if you refer to a memory cell other than the 100 that is available, that is, if the argument passed to mem is smaller than 0 or bigger than 99. mem(101).
  2658.  
  2659. 9.29. Trying to take root of negative value
  2660.  
  2661.     This error will appear if you try to take the root of a negative value. √-1.
  2662. 9.30. Trying to take tangent of odd multiple of π/2
  2663.  
  2664.     This error will appear if you try to take tangent of an odd multiple of π/2, since tangent is not defined for these values. tan(3π/2).
  2665.  
  2666. 9.31. Trying to use 1, 0 or a negative number as base for a logarithm
  2667.  
  2668.     This error will appear, because these numbers cannot be used as bases for logarithms.
  2669.  
  2670. 9.32. Unknown character used
  2671.  
  2672.     This error will appear if you have used a character that the calculator doesn't know of, like å, ä or ö, outside a string.
  2673.  
  2674. 9.33. Unknown character combination used
  2675.  
  2676.     This error will appear if you have used characters that the calculator know of, but grouped them in some strange fashion. Writing 3 >* 3 will raise this error.
  2677.  
  2678. 9.34. Unknown function used
  2679.  
  2680.     This error will appear if you have used a function that the calculator doesn't know of, like DrawSphere(). If you get this error check for typing mistakes. Remember that the calculator bothers about the case of a word, so although there is a function FRect(), it will not recognize fRect().
  2681.  
  2682. 9.35. Unrecognized function
  2683.  
  2684.     This error will appear if you have used a function that the computer doesn't recognize, like drawSphere().
  2685.  
  2686. 9.36. Value returned by sinh too large
  2687.  
  2688.     This error will appear if you pass a too big value to sinh.
  2689.  
  2690. 9.37. Value returned by cosh too large
  2691.  
  2692.     This error will appear if you pass a too big value to cosh.
  2693.  
  2694. 10. Technical Information
  2695.  
  2696. 10.1. How the calculator works
  2697.  
  2698. The calculator gets it results from a two step process.
  2699.  
  2700. In the first step the actual text that the user has written is transformed to a stack of entries compiled using reverse polish notation. This step can be called compilation, remembering, though, that the text is not compiled to machine language, but to a simpler form.
  2701.  
  2702. The next step might be called interpretation. The computer then uses the code created by the previous step and executes each function as it encounters it. When the computer reaches the end of the code the program terminates.
  2703.  
  2704. 10.2. Text to reverse polish notation
  2705.  
  2706. In pseudocode (extremely pseudo), this process might look like this:
  2707.  
  2708.  1. Look at each character in the input string
  2709.  
  2710.  2a. If the character is a number
  2711.     (Read the number and push it to the RPN stack.)
  2712.  
  2713.  2b. If the character is a function
  2714.     (Read the function and push it to the command stack. If the previous entries in the command stack are of higher precedence, taking in account of course any parentheses, than this entry,  pop them from the command stack and push them to the RPN stack.)
  2715.  
  2716.  3. Continue until the entire input string has been examined, then pop all entries from the command stack and push them to the RPN stack.
  2717.  
  2718. If the input string is: (3 + 2) * (4 + 6), what will happen is this:
  2719.  
  2720.  1. The computer reads 3 and pushes it to the RPN stack.
  2721.     RPN stack: 3
  2722.     Command stack: 
  2723.  
  2724.  2. The computer reads + (at parentheses-level 1) and pushes it to the command stack, there are no previous entries to be popped.
  2725.     RPN stack: 3
  2726.     Command stack: +(1)
  2727.  
  2728.  3. The computer reads 2 and pushes it to the RPN stack.
  2729.     RPN stack: 3 2
  2730.     Command stack: +(1)
  2731.  
  2732.  4. The computer reads * (at parentheses-level 0) and pushes it to the command stack, since +(1) is of higher precedence (because of the higher level of parentheses) it is popped from the command stack and pushed to the RPN stack.
  2733.     RPN stack: 3 2 +
  2734.     Command stack: *(0)
  2735.  
  2736.  5. The computer reads 4 and pushes it to the RPN stack.
  2737.     RPN stack: 3 2 + 4
  2738.     Command stack: *(0)
  2739.  
  2740.  6. The computer reads +(1), since this is of higher level than *(0), *(0) remains at the command stack.
  2741.     RPN stack: 3 2 + 4
  2742.     Command stack: *(0) +(1)
  2743.  
  2744.  7. The computer reads 6, and pushes it to the RPN stack.
  2745.     RPN stack: 3 2 + 4 6
  2746.     Command stack: *(0) +(1)
  2747.  
  2748.  8. The computer reaches the end of the string, pops all entries from the command stack and pushes them to the RPN stack.
  2749.     RPN stack: 3 2 + 4 6 + *
  2750.     Command stack: 
  2751.  
  2752. And that's it!
  2753.  
  2754. 10.3. About reverse polish notation
  2755.  
  2756. Reverse Polish Notation (RPN) is a notation that makes it possible to write any mathematical expression without parentheses. (RPN is the native language of the programming language Forth.)
  2757.  
  2758. An expression in reverse polish notation might look something like this:
  2759.  
  2760.     3 2 + 4 6 + *
  2761.  
  2762. When an expression in reverse polish notation is evaluated any encountered numbers are pushed to a stack (that we might call the result stack). When a function is encountered it pops as many arguments as it needs from the result stack, performs whatever operation it should perform on this arguments and pushes the result back to the result stack.
  2763.  
  2764. If the example expression above was interpreted, this is what would happen:
  2765.  
  2766.  1. The computer reads 3, it is pushed to the result stack.
  2767.     Result stack: 3
  2768.  
  2769.  2. The computer reads 2, it is pushed to the result stack.
  2770.     Result stack: 3 2
  2771.  
  2772.  3. The computer reads +. This function needs two arguments, so it pops 2 and 3 from the stack, performs its operation (2 + 3). And pushes the result (5) to the stack.
  2773.     Result stack: 5
  2774.  
  2775.  4. The computer reads 4 and pushes it to the result stack.
  2776.     Result stack: 5 4
  2777.  
  2778.  5. The computer reads 6 and pushes it to the result stack.
  2779.     Result stack: 5 4 6
  2780.  
  2781.  6. The computer reads +. This functions needs two arguments so it pops 6 and 4 from the stack, performs its operation (4 + 6) and pushes the result (10) to the stack.
  2782.     Result stack: 5 10
  2783.  
  2784.  7. The computer reads *. 5 and 10 are popped from the stack and (5 * 10 = 50) is pushed to the stack.
  2785.     Result stack: 50
  2786.  
  2787. The final value of the result stack is the searched value. If you think of it, you will realise that 3 2 + 4 6 + * is in fact equal to (3 + 2) * (4 + 6) in ordinary notation.
  2788.  
  2789. The calculator will understand RPN if you use commas to delimit the separate entries, that is you may write (3 + 2) * (4 + 6) as 3, 2, +, 4, 6, +, *.
  2790.  
  2791. 11. Table of Content
  2792.  
  2793.   1. General Instructions
  2794.     1.1. About this program
  2795.     1.2. How to use it
  2796.     1.3. How to learn using the calculator
  2797.     1.4. General editing instructions
  2798.     1.5. Using multiple calculators
  2799.  
  2800.   2. The Menu Options
  2801.     2.1. The Apple menu
  2802.     2.2. The File menu
  2803.     2.3. The Edit menu
  2804.     2.4. The Calculator menu
  2805.     2.5. Calculator specific menus
  2806.  
  2807.   3. The Layman's Calculator
  2808.     3.1. The window
  2809.     3.2. Entering an expression
  2810.     3.3. Using the results of calculations
  2811.  
  2812.   4. The Scientific Calculator
  2813.     4.1. The window
  2814.     4.2. Using complex numbers
  2815.     4.3. Using variables
  2816.       4.3.1 Variables available
  2817.       4.3.2 Storing something in a variable
  2818.       4.3.3 Using a variable's value
  2819.     4.4. Doing multiple calculations
  2820.     4.5. Using reverse polish notation
  2821.  
  2822.   5. The Graph Drawer
  2823.     5.1. The window
  2824.     5.2. The Graph menu
  2825.     5.3. Ordinary graphs
  2826.     5.4. Polar graphs
  2827.     5.5. Parametric graphs
  2828.     5.6. Zooming and scrolling
  2829.     5.7. Finding intersections
  2830.     5.8. Numerical differentiation
  2831.     5.9. Numerical integration
  2832.  
  2833.   6. The Programmable Calculator
  2834.     6.1. The window
  2835.     6.2. The Programmable menu
  2836.     6.3. General editing instructions
  2837.     6.4. Programming vs. calculation
  2838.     6.5. Using variables
  2839.       6.5.1 Variables available
  2840.       6.5.2 Storing something in a variable
  2841.       6.5.3 Using a variable's value
  2842.     6.6. Controlling program flow
  2843.       6.6.1 The if - else - end construction
  2844.       6.6.2 The while-end construction
  2845.     6.7. Comparison of control functions
  2846.       6.7.1 goto
  2847.       6.7.2 gosub, functions
  2848.       6.7.3 else if
  2849.       6.7.4 switch, case
  2850.       6.7.5 for, next
  2851.     6.8. Getting data from the user
  2852.       6.8.1 Getting Data From Dialogs
  2853.       6.8.2 Getting Data From The Mouse
  2854.     6.9. Displaying data to the user
  2855.     6.10. Presenting data in dialogs
  2856.     6.11. Presenting data in a graphic window
  2857.     6.12. Sample programs
  2858.     6.12.1 Guessing game
  2859.     6.12.2 Mirror drawer
  2860.  
  2861.   7. Function Reference
  2862.     7.1. Function glossary
  2863.     7.2. Complex
  2864.     7.3. Dialogs
  2865.     7.4. Drawing
  2866.     7.5. Economic functions
  2867.     7.6. Exponential functions
  2868.     7.7. Integer
  2869.     7.8. Logical functions
  2870.     7.9. Memory functions
  2871.     7.10. Mouse functions
  2872.     7.11. Printing text and numbers
  2873.     7.12. Program flow
  2874.     7.13. Real-value
  2875.     7.14. Sign functions
  2876.     7.15. Time functions
  2877.     7.16. Trigonometric
  2878.     7.17. Window functions
  2879.  
  2880.   8. Formulas
  2881.     8.1. Mathematics
  2882.       8.1.1 Fundamental algebraic laws
  2883.       8.1.2 Approximations
  2884.       8.1.3 Algebra
  2885.         8.1.3.1 Quadratic laws, binomial theorem
  2886.         8.1.3.2 Solving Quadratic Equations
  2887.         8.1.3.3 Fundamental Theorem of Algebra
  2888.       8.1.4 Logarithms and Exponents
  2889.         8.1.4.1 Laws for Exponents
  2890.         8.1.4.2 Definition of Logarithms
  2891.         8.1.4.3 Logarithm Laws
  2892.       8.1.5 Analytical geometry
  2893.         8.1.5.1 Midpoints
  2894.         8.1.5.2 Distances
  2895.         8.1.5.3 Scalar Product
  2896.         8.1.5.4 Vector length
  2897.         8.1.5.5 Angle between vectors
  2898.         8.1.5.6 Straight Lines
  2899.       8.1.6 Calculus
  2900.         8.1.6.1 Increasing/Decreasing Functions
  2901.         8.1.6.2 Local maximum and minimum
  2902.         8.1.6.3 Derivative of Function
  2903.         8.1.6.4 Finding Maximum and Minimum
  2904.         8.1.6.5 Determining concavity
  2905.         8.1.6.6 Mean Value Theorem
  2906.       8.1.7 Rules of Differentiation
  2907.         8.1.7.1 Arithmetic Operations
  2908.         8.1.7.2 Common derivatives
  2909.       8.1.8 Integrals
  2910.         8.1.8.1 Primitive functions
  2911.         8.1.8.2 Rules of Integration
  2912.         8.1.8.3 Common Integration Methods
  2913.         8.1.8.4 Some primitive functions
  2914.       8.1.9 Conics
  2915.       8.1.10 Differential equations
  2916.         8.1.10.1 First order
  2917.         8.1.10.2 Second order
  2918.       8.1.11 Geometry
  2919.         8.1.11.1 Parallelogram 
  2920.         8.1.11.2 Parallel trapezium
  2921.         8.1.11.3 Circle
  2922.         8.1.11.4 Circle sector
  2923.         8.1.11.5 Prism
  2924.         8.1.11.6 Pyramid
  2925.         8.1.11.7 Straight circular cylinder
  2926.         8.1.11.8 Straight circular cone
  2927.         8.1.11.9 Sphere
  2928.       8.1.12 Trigonometry
  2929.         8.1.12.1 Pythagora's theorem
  2930.         8.1.12.2 Definitions
  2931.         8.1.12.3 The Triangle
  2932.         8.1.12.4 Trigonometric Identities
  2933.       8.1.13 Sequences and series
  2934.         8.1.13.1 Arithmetic sequence
  2935.         8.1.13.2 Geometric sequence
  2936.         8.1.13.3 Convergence
  2937.       8.1.14 Statistics
  2938.         8.1.14.1 Concepts
  2939.         8.1.14.2 Mean, median, mode
  2940.         8.1.14.3 Standard deviation
  2941.       8.1.15 Probability
  2942.         8.1.15.1 Basic Concepts
  2943.         8.1.15.2 Binomial distribution
  2944.         8.1.15.3 The common frequency function
  2945.         8.1.15.4 Interval of confidence
  2946.     8.2. Physics
  2947.       8.2.1 Physical constants
  2948.       8.2.2 Mechanics
  2949.         8.2.2.1 Density
  2950.         8.2.2.2 Pressure
  2951.         8.2.2.3 Velocity, acceleration
  2952.         8.2.2.4 Movement with constant acceleration
  2953.         8.2.2.5 Newton's second law of motion
  2954.         8.2.2.6 Moment
  2955.         8.2.2.7 Newton's law of gravitation
  2956.         8.2.2.8 Friction
  2957.         8.2.2.9 Throwing parabola
  2958.         8.2.2.10 Momentum
  2959.         8.2.2.11 Centripetal force
  2960.         8.2.2.12 Harmonic motion
  2961.         8.2.2.13 Work, energy
  2962.         8.2.2.14 Power
  2963.         8.2.2.15 Straight central collision
  2964.         8.2.2.16 Hookes' law
  2965.       8.2.3 Proprieties of gases
  2966.         8.2.3.1 Boyle's law
  2967.         8.2.3.2 Charles' law
  2968.         8.2.3.3 Gay-Lussac's law
  2969.         8.2.3.4 General gas law
  2970.         8.2.3.5 Volume expansion of a gas at constant pressure
  2971.         8.2.3.6 Dalton's law
  2972.         8.2.3.7 Kinetic gas theory
  2973.       8.2.4 Theory of heat
  2974.       8.2.5 Electronics I - Electrostatics, direct current
  2975.         8.2.5.1 Coulomb's law
  2976.         8.2.5.2 Charge
  2977.         8.2.5.3 Voltage
  2978.         8.2.5.4 Electric Field Force
  2979.         8.2.5.5 Capacitance
  2980.         8.2.5.6 Resistance
  2981.         8.2.5.7 Electrolytic battery
  2982.         8.2.5.8 Power and energy
  2983.       8.2.6 Electronics II Magnetism
  2984.         8.2.6.1 Magnetic flux density
  2985.         8.2.6.2 Laplace's formula
  2986.         8.2.6.3 Magnetic flux
  2987.         8.2.6.4 Force between magnetic fields and charges in motion
  2988.         8.2.6.5 Electromagnetic induction
  2989.       8.2.7 Electronics III. Alternating current.
  2990.         8.2.7.1 Basics
  2991.         8.2.7.2 Impedance and phase lag
  2992.         8.2.7.3 Resonance
  2993.         8.2.7.4 Power
  2994.         8.2.7.5 Transformer
  2995.         8.2.7.6 Electronic oscillator
  2996.       8.2.8 Optics
  2997.         8.2.8.1 Photometrics
  2998.         8.2.8.2 Spherical mirrors
  2999.         8.2.8.3 Law of refraction
  3000.         8.2.8.4 Index of refraction
  3001.         8.2.8.5 Minimum deviation in prism
  3002.         8.2.8.6 Thin lenses
  3003.       8.2.9 Wave theory
  3004.         8.2.9.1 Basics
  3005.         8.2.9.2 Doppler effect
  3006.         8.2.9.3 Speed of sound
  3007.       8.2.10 Electromagnetic radiation
  3008.         8.2.10.1 Stefan-Boltzmann's law
  3009.         8.2.10.2 Wien's displacement law
  3010.         8.2.10.3 Diffraction grating
  3011.       8.2.11 Nuclear physics
  3012.         8.2.11.1 Planck's law
  3013.         8.2.11.2 Photoelectric effect
  3014.         8.2.11.3 de Broglie's formula
  3015.         8.2.11.4 Radioactive decay
  3016.         8.2.11.5 Theory of relativity
  3017.     8.3. Chemistry
  3018.       8.3.1 Chemical equilibrium
  3019.       8.3.2 Acids and bases
  3020.     8.4. Economics
  3021.       8.4.1 Interest
  3022.  
  3023.   9. Error Codes
  3024.     9.1. Acsc value not defined
  3025.     9.2. Arccosine argument not between -1 and 1
  3026.     9.3. Arcsine argument not between -1 and 1
  3027.     9.4. Asec value not defined
  3028.     9.5. Cot value not defined
  3029.     9.6. Csc value not defined
  3030.     9.7. Division by complex zero
  3031.     9.8. Division by zero
  3032.     9.9. Else without if
  3033.     9.10. End without while or if
  3034.     9.11. Expression too complex
  3035.     9.12. Function lacking arguments
  3036.     9.13. Function name too long
  3037.     9.14. Function nesting too complex
  3038.     9.15. Interrupted by user
  3039.     9.16. Invalid arithmetic sum
  3040.     9.17. Invalid geometric sum
  3041.     9.18. Modulo zero
  3042.     9.19. Number or text used where variable is required
  3043.     9.20. Passing non-text arguments to a function which requires text arguments
  3044.     9.21. Program too long
  3045.     9.22. Raising negative number to fraction exponents
  3046.     9.23. Raising zero to negative exponent
  3047.     9.24. Sec value not defined
  3048.     9.25. Trying to calculate logarithm of negative value or zero
  3049.     9.26. Trying to invert zero
  3050.     9.27. Trying to permute negative value
  3051.     9.28. Trying to read beyond memory
  3052.     9.29. Trying to take root of negative value
  3053.     9.30. Trying to take tangent of odd multiple of π/2
  3054.     9.31. Trying to use 1, 0 or a negative number as base for a logarithm
  3055.     9.32. Unknown character used
  3056.     9.33. Unknown character combination used
  3057.     9.34. Unknown function used
  3058.     9.35. Unrecognized function
  3059.     9.36. Value returned by sinh too large
  3060.     9.37. Value returned by cosh too large
  3061.  
  3062.   10. Technical Information
  3063.     10.1. How the calculator works
  3064.     10.2. Text to reverse polish notation
  3065.     10.3. About reverse polish notation
  3066.